The 36-year-old made the announcement through a statement on his instagram page.
"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 aspects. My heart is clear and time is right to walk into a new chapter," du Plessis posted.
"It has been an honour to play for my country in all formats of the game but the time has come for me to retire from Test cricket.
"The next two years are ICC T20 World Cup years. Because of this my focus is shifting to this format...," he said.
Du Plessis played 69 Tests, scoring 4163 runs at an average of 40.02.
He stepped down as South Africa''s Test and T20 captain last year after taking over the job from A B de Villiers back in 2016.