The world and Olympic champion told a packed news conference broadcast live on Australian television that he had decided to quit because swimming was no longer the most important thing in his life.
"It's emotional because I see my entire swimming career flashing before my eyes but at the same time I have this excitement about what I'm about to do," Thorpe said.
"I don't think I should be retiring, I think I'm far too young to retire but it's a thing that we should be celebrating. I've had a great career," he said.
"It isn't the best time for me to be walking away from the sport but it's my time, this is how it panned out," a relaxed and unshaven Thorpe said.
Thorpe described his decision to quit as the toughest he had ever made but would not completely rule out the possibility of a comeback for the 2008 Beijing Olympics. The Australian is immensely popular in China.
"I don't see myself competing again. I don't think it will happen," Thorpe said.
"I won't rule it out. I never rule anything out, but it's just not going to happen," he said.
Thorpe is regarded as one of the greatest swimmers of all time after winning 11 world titles, five Olympic gold medals and setting 13 individual long-course world records.
REMARKABLE SWIMMER
Tributes quickly poured in for Thorpe. Australian Prime Minister John Howard described him as a remarkable swimmer and "a good bloke" and said his retirement was an enormous loss.
"Millions of Australians will remember his wonderful individual performances," Howard told reporters in Vietnam.
Thorpe said it would have been easier for him to keep swimming and compete in the world championships next March but was worried that swimming had become a "safety blanket".
Thorpe took up swimming at the age of five and became the youngest men's world champion in the sport's history when the then 15-year-old won the 400 metres freestyle at the 1998 world titles in Perth.
"You can swim lap after lap staring at a black line and all of a sudden you look up and see what's around," he said.
Worn down by the constant grind of training, Thorpe took a year off after winning the 200 metres and 400m freestyle titles at the 2004 Athens Olympics but his comeback plans were thwarted by illness and waning motivation.
He began to question his continued involvement in the sport during three months of training in Los Angeles this year. It was then he realised for the first time that swimming was not his main priority.
Thorpe said he had several opportunities open to him but gave few details about what he would do next other than to say he wanted to remain in swimming.
"I haven't picked up a newspaper to look for a job, but if anyone's got any good ones for an ex-Olympic swimmer ...," Thorpe said.