Federer, a 20-time Grand Slam champion, cited recent injuries and surgeries as factors leading to his decision.
"As many of you know, the past three years have presented me with challenges in the form of injuries and surgeries," Federer said. "I've worked hard to return to full competitive form. But I also know my body's capacities and limits, and its message to me lately has been clear.
"I am 41 years old. I have played more than 1,500 matches over 24 years. Tennis has treated me more generously than I ever would have dreamt, and now I must recognize when it is time to end my competitive career."