"I have decided to retire from all international cricket with immediate effect," he said on Wednesday. "It is time for others to take over. I have had my turn, and to be honest, I am tired.
"This is a tough decision, I have thought long and hard about it and I'd like to retire while still playing decent cricket. After the fantastic series wins against India and Australia, now feels like the right time to step aside.
"It would not be right for me to pick and choose where, when and in what format I play for the Proteas. For me, in the green and gold, it must be everything or nothing. I will always be grateful to the coaches and staff of Cricket South Africa for their support through all these years. The most important thank you goes out to all of my team mates throughout my career, I wouldn't be half the player that I am without the support throughout the years.
"It's not about earning more somewhere else, it's about running out of gas and feeling that it is the right time to move on. Everything comes to an end. To the cricket fans around South Africa and the World, thank you for your kindness and generosity, and today, for your understanding.
"I have no plans to play overseas, in fact, I hope I can continue to be available for the Titans in domestic cricket. I will continue to be the biggest supporter of Faf du Plessis and the Proteas."
Cricket South Africa President Chris Nenzani paid tribute to De Villiers.
"AB is one of the all-time greats of South African cricket who has thrilled spectators around the world with his sheer brilliance, coupled to his ability to innovate and take modern day batting in all three formats but particularly in the white ball ones to new levels.
What is probably more important is the inspiration he has been to his team mates whether playing at international or domestic level and the wonderful role model he has been to all our aspiring youngsters. It goes without saying that he is going to be greatly missed wherever international cricket is played."