Vettel won his four world drivers' titles with Red Bull
The 35-year-old said the decision had been "difficult" and that he had "spent a lot of time thinking about it".
The German said he would "take more time to reflect on what I will focus on next" at the end of the year. He said spending more time with his family was a priority.
Vettel will leave the sport as one of the most successful drivers in history.
Only Lewis Hamilton, Michael Schumacher and Juan Manuel Fangio have won more world titles than Vettel, and only Hamilton and Schumacher have more than his 53 race wins.
He added: "Today is not about saying goodbye. Rather, it is about saying thank you - to everyone - not least to the fans, without whose passionate support F1 could not exist."
Vettel, who won four consecutive drivers' titles with Red Bull from 2010 to 2013, said he had "really enjoyed" his time with Aston Martin in 2021 and 2022, adding: "Although our results have not been as good as we had hoped, it is very clear to me that everything is being put together that a team needs to race at the very highest level for years to come.
"I hope that the work I did last year and am continuing to do this year will be helpful in the development of a team that will win in the future, and I will work as hard as I can between now and the end of the year with that goal in mind, giving as always my best in the last 10 races."
Aston Martin had wanted to keep Vettel next season, but he decided he wanted to step away from the sport.
In recent years he has become an outspoken campaigner on social and environmental issues.
Vettel has always eschewed social media, but he launched an Instagram account on Thursday just before his retirement announcement, with his biography there describing him as "public figure".
In a video on his website on Thursday, he said: "I love this sport but as much as there is life on track there is my life off track, too. Being a racing driver has never been my sole identity.
"I believe in change and progress and that every little bit makes a difference.
"Committing to my passion no longer goes side by side with my wish to be a great father and a husband."
He added: "I feel we live in very decisive times and how we all shape these next years will determine our lives.
"My passion comes with certain aspects that I have learnt to dislike. They might be solved in the future but the will to apply that change has to become much stronger and has to lead to action today - we cannot afford to wait.
"My best race is still to come."
Aston Martin have made no announcement about a replacement for Vettel next season.
Vettel, who has raced in F1 full time since 2007, has had a career in two parts.
His most successful era was with Red Bull, who he joined in 2009, and for whom he won 38 grands prix and four consecutive titles from 2010-2013.
The second and fourth of those titles were seasons of extraordinary domination.
In 2013, he won 13 races in the season, equalling the record set by Schumacher in 2004, including the last nine in a row - the longest run of consecutive victories in a single season, and the equal longest run ever. Alberto Ascari also won nine in a row across the 1952 and 1953 seasons.
But his triumphs in 2010 and 2012 came at the end of intense, season-long battles.
His first title was won in extraordinary circumstances and in a fight with four other drivers through the year - his Red Bull team-mate Mark Webber, Ferrari's Fernando Alonso and the McLaren pair of Hamilton and Jenson Button.
Vettel went into the final race in Abu Dhabi third in the championship behind Alonso and Webber, having never led the points all year.
But after Ferrari made a catastrophic strategic mistake and called Alonso into the pits in response to Webber, the Spaniard was unable to climb back through the field, and Vettel dominated the race to overtake both his rivals and clinch the title.
In 2012, the fight was even more intense, as the season devolved into a straight fight between Vettel and Alonso.
In a slower car, Alonso built a huge lead as Vettel and Red Bull ran into a series of problems in the first half of the season and Alonso was 39 points ahead of him with seven races to go.
But intense development to the Red Bull car led Vettel to win four races in a row in Singapore, Japan, South Korea and India in the final third of the season. Helped by Alonso being taken out at the start in Belgium and Japan by Lotus drivers Romain Grosjean and Kimi Raikkonen, Vettel overhauled the gap and held on in the final three races to clinch his third title.
Vettel's run of success ended in 2014, when new engine regulations ushered in a period of Mercedes domination, and he began a period of unexpected inconsistency.
He was outperformed in his final year at Red Bull by new team-mate Daniel Ricciardo, and then moved to Ferrari for 2015, openly saying he wanted to follow in the footsteps of his childhood hero Schumacher, who had won five titles with the Italian team from 2000-2004.
Vettel won 14 races for the team between 2015 and 2019, making him the third most successful driver in its history in terms of victories.
But he and the team fell short of the title he so craved, despite having the most competitive car for much of the 2017 and 2018 seasons.
There were reliability and operational problems on Ferrari's part, but through 2018 Vettel also began to make a series of mistakes, the frequency of which was highly unusual for a driver of his calibre and which have never been fully explained.
Ultimately, the team lost faith in Vettel. In 2019, they signed Charles Leclerc as a benchmark for him in only the Monegasque's second season in the sport.
Leclerc outperformed him in his first year with the team. When the 2020 season was delayed by the pandemic, Ferrari made the decision in the period before it started to drop Vettel at the end of it.
The decision caught Vettel by surprise, and he made no secret of the fact that he was affected by it. Regardless, his legacy will be as one of the greatest drivers in the history of the sport.
After leaving Ferrari, Vettel's true character has become clearer, as he has felt freer to speak his mind.
He has been a director of the Grand Prix Drivers' Association for several years, and has become an increasingly potent spokesman on major global issues, particularly the climate crisis.
He appeared on BBC's Question Time earlier this year, and came across as an eloquent and intelligent figure, more than capable of addressing the contradictory position in which he found himself as an environmentalist and F1 driver.
He admitted it made him a hypocrite, and said it made him question whether racing in F1 was the right thing to do.
"It's my passion to drive a car," he said. "Every time I step in the car, I love it. When I get out of the car, of course I'm thinking as well: 'Is this something we should do, travel the world, wasting resources?'"
In his own case, he now has an answer.
-- Courtesy of BBC Sport