The Australian, 26, had denied rumours that he was to quit the sport at the previous round of the championship in Portugal, but he revealed his intention to call time on his career at a press conference ahead of this weekend's French Grand Prix.
Stoner told a press conference: "After a long time thinking, a lot of time talking with my family and my wife, this has been coming for a couple of years now, but at the end of this 2012 season I will be not racing in the 2013 Championship.
"I will be finishing my career at the end of this season in MotoGP, and go forward in different things in my life.
"After so many years of doing this sport which I love, and which myself and my family made so many sacrifices for, after so many years of trying to get to where we have gotten to at this point, this sport has changed a lot and it has changed to the point where I am not enjoying it.
"I don't have the passion for it and so at this time it's better if I retire now.
"There are a lot of things that have disappointed me, and also a lot of things I have loved about this sport, but unfortunately the balance has gone in the wrong direction.
"And so, basically, we won't be continuing any more. It would be nice if I could say I would stay one more year, but then where does it stop? So we decided to finish everything as we are now."
Stoner's Repsol Honda team confirmed the news on their official Twitter feed, saying "Casey just announced that 2012 will be his final year in the MotoGP Championship. Let's hope he has a fantastic year!"
The New South Wales rider stepped up to MotoGP with the LCR Honda team in 2006, having finished second in the 250cc class in 2005.
Watch: Stoner to retire after MotoGP season.. More Videos
After a promising maiden season he moved to Ducati in 2007 and completely dominated the championship by claiming 10 wins.
He finished runner-up to Valentino Rossi a year later, before a mystery illness derailed his 2009 campaign.
After another frustrating season in 2010 Stoner made the decision to move to the factory Repsol Honda team, and was once again the class of the field as he secured his second world title in 2011.
Stoner, who has won 35 races in the top class, currently leads the championship by a single point from Yamaha's Jorge Lorenzo after claiming victories in Spain and Portugal.
Stoner's decision to retire will see MotoGP lose one of its leading personalities.
But the world champion had previously stated he did not want to still be racing in his 30s, and initial suggestions that he might retire had surfaced after he became a father in February.
However, Stoner had denied there was any substance in those rumours in Estoril, where he told the media: "Everyone seems quite good at stories and making them up.
"I've said many times in the past that my career's not going to go on much longer, I'm not going to keep going and riding until I'm in my 30s and things like this.
"For me at the moment, I haven't decided what I'm going to be doing, and certainly no one else is going to know what I'm doing."
His retirement will also leave a vacancy at Repsol Honda that plenty of riders will be keen to fill.
Repsol protege Marc Marquez, the 2010 125cc champion and current Moto2 series leader, would appear to be the leading candidate to fill the vacancy, although Lorenzo has also been linked with a switch from the factory Yamaha squad and the Spaniard is out of contract at the end of the year.
Rossi could prove to be among the more fanciful suggestions for the seat.
The Italian is enduring a miserable second season with Ducati but it is hard to see him returning to Honda after the bitter manner of his departure to Yamaha at the end of 2003.