Du Plessis featured in 69 Test matches for his country and scored over 4,000 runs.
Du Plessis revealed the decision through an Instagram post.
“It has been a year of refinement in the fire for us all. Uncertain were the times, but they brought clarity for me in many respects. My heart is clear and the time is right to walk into a new chapter. It has been an honour to play for my country in all the formats of the game, but the time has come for me to retire from Test cricket,” he wrote in his retirement statement.
"If someone had told me 15 years ago, that I would play 69 Test matches for South Africa and captain the side, I wouldn't have believed them. I stand in a place of utmost gratitude for a test coreer full of blessings bestowed on me. Every high and low has shaped me into the man I am proud to stand as today. In all things, those instances worked towards the good of who I believe I am today."
Du Plessis further stated that he has taken the decision by keeping in mind the upcoming editions of the T20 World Cup in 2021 and 2022.
"The next two years are ICC T20 World cup years. Because of this, my focus is shifting to this format and I want to play as much of it as possible around the world so that I can be the best player I can possibly be. I strongly believe that I have a lot to offer to the Proteas in this format. This does not mean that ODI cricket is no longer in the plans, I'm just making T20 cricket the priority in the short-term," he wrote.
"I will be in conversation with CSA over the next couple of months on what the future might look like for me over the next year to find a solution that works for both of us
"For now, I would like to take this opportunity to thank each and every person who had an influence on my Test career. I would like to single out my wife and family in particular - I would not have been able to do without their support during the unforgettable journey that Test cricket has taken me on, To my coaches, teammates and support staff over the years, I would you like to give a note of thanks and of course, to Cricket South Africa for the opportunity to be able to represent and lead my country in the pinnacle of the game we all love. It has been an incredible journey, with many stories that I look forward to one day sharing."
Faf du Plessis made his Test debut against Australia in Adelaide in November 2012. His last Test match was against Pakistan in Rawalpindi earlier this month.
Overall, he aggregated scored 4,163 runs in the traditional format at an average of 40.02. He also slammed 10 centuries and 21 fifties in his Test career.