The 32-year-old was part of the 38-man All Blacks training squad in Tauranga this week ahead of the three test series against France next month.
He will continue to play for the Blues.
All Blacks head coach Steve Hansen congratulated Williams on his career in the All Blacks and said he respected Williams' decision to retire and go out on his terms.
"By retiring he is doing what's best for the All Blacks and showing a tremendous amount of integrity by putting the team ahead of himself. He knew he may have been selected for the All Blacks again this year, but he also knows that it is better for the team to have a younger player in the position.
"Ali has been a fantastic All Black. He is a player who has always worn his heart on his sleeve, he is a real character who loved being an All Black and wearing the jersey proudly and representing his country, and that's what we love about him.
"He would have played a lot more games for the team if injuries hadn't robbed him of the opportunity. But it took a lot of courage to come back to top-flight rugby and that is a measure of the man and shows just how much he loves the game."
Williams made his test debut on the 2002 end-of-year tour against England, a 28-31 defeat. The following year he became a regular feature in the side however 2003 included the first of two World Cup exits for Williams after the All Blacks were knocked out of the tournament following a semifinal defeat to Australia.
Williams played in all three tests when the All Blacks clean-swept the British and Irish Lions in 2005 but was part of another World Cup exit two years later in Cardiff.
The Aucklander finally tasted World Cup success in third tournament when New Zealand played host in 2011. He played in all seven matches and came on as a second half substitute in the final to leave the field a world champion.
His final test was a 42-10 victory over Italy in Rome last year. He scored seven tries in 78 games for the All Blacks, including a match against the Barbarians in 2004.
His 77 test caps include 16 tests against Australia, 14 against South Africa and 11 against France.
"Ali has been one of the great servants of New Zealand rugby and, on behalf of New Zealand Rugby, we congratulate him on his All Blacks career. He still has a lot to offer the game here, is obviously making an outstanding contribution to the Blues and wants to continue doing that which is great for New Zealand rugby," New Zealand Rugby CEO Steve Tew added.
Super Rugby coach Sir John Kirwan had plenty of praise for his veteran lock.
"I'm incredibly proud of Ali; it must have been a very difficult decision for him to make. A lot of players at his stage in their career are looking to go overseas, but he really wants to commit to the Blues and stay here and help this young side grow and achieve their goals, which is fantastic.
"He's been a great All Black and I'm looking forward to him being fully committed and focussed on the Blues and enjoying himself."
Where does Williams rank amongst the all-time best All Blacks locks? Share your thoughts and memories of his All Black career below.
- nzherald.co.nz