Ferdinand said it was "the right time" to retire from "the game I love", in a statement read out on BT Sport.
London-born Ferdinand, who had 12 years at Manchester United after spells with West Ham and Leeds, last played for QPR in March.
In the statement, he paid tribute to his wife Rebecca Ellison, who died from breast cancer on 1 May.
Announcing his retirement, Ferdinand said: "After 18 years as a professional footballer, I now feel it's the right time for me to retire from the game that I love.
"As a 12-year-old boy, kicking around a football on the Friary Estate in Peckham, I never dreamt that I would play for my boyhood club West Ham, captain Leeds United, win the Champions League with Manchester United, or re-join my first manager Harry Redknapp at Queens Park Rangers.
"I will always regard the 81 times that I played for England with immense pride. These are all treasured memories that will last a lifetime."
Ferdinand began his career under Redknapp at West Ham, and had a short loan spell at Bournemouth before making his England debut at the age of 19 in 1997.
He joined Leeds for £18m in 2000, and then moved to Manchester United two years later in a deal worth £29.1m, which at the time was a world-record fee for a defender.
While at Old Trafford, he won six Premier League titles, and lifted the Champions League in 2008 as Chelsea were beaten on penalties in Moscow.
He captained England for the first time in 2008, and replaced John Terry in the role on a full-time basis in February 2010, but missed out on the chance to lead his country at that year's World Cup in South Africa after suffering knee ligament damage during a pre-tournament training session. Terry was reinstated as captain in 2012.
Manchester United released Ferdinand in 2014 and he moved to QPR, but was unable to save them from being relegated as they finished bottom of the Premier League.
Former United and England team-mate Paul Scholes said of Ferdinand: "He was a great player, without a doubt the best centre-half I ever played with. I would say for a time as well he was the best centre-half in the world.
"He was such a pleasure to play with and play in front of. To play in front of him, he made your job so easy."
Former England striker Michael Owen, who also played alongside Ferdinand at Old Trafford, tweeted: "What a player he was; absolute Rolls Royce."