The former Bayern Munich and Germany defender had been without a club since leave Switzerland side FC Luzern in December last year.
Badstuber came through the Bayern Munich youth ranks to make 178 appearances for the senior side, winning six Bundesliga titles, four DFB-Pokals, one UEFA Champions League, one UEFA Super Cup and one FIFA Club World Cup.
But for a succession of knee, ankle and thigh injuries, Badstuber could have made more appearances for Bayern, having also played for Schalke 04 and Stuttgart.
Badstuber won 31 caps for the German national team but now plans to go into coaching after hanging up his boots.
"Dear fans... after 13 years of professional football, I'm announcing the end of my career as an active player," Badstuber wrote on Twitter.
"With 31 senior international matches, World Cup and European Championship appearances, six German championships, four DFB-Pokal victories, winning the Champions League, the Club World Cup, the UEFA Super Cup and three national super cups, I can look back on a successful period.
"Of course I would have wished for a few less serious injuries, but the joy of what has been achieved is very great. I am thankful for everything.
"I will stay true to football, my passion. I will follow in my father's footsteps and start a coaching course.
"I hope that I will stay with football for a long time, albeit in a different role. Many thanks to all my companions and to you fans."