Posting on Twitter, the five-time year-end World No. 1 said, “During the grass-court season, I unfortunately experienced a setback with my knee, and have accepted that I must withdraw from the Tokyo Olympic Games. I am greatly disappointed, as it has been an honor and highlight of my career each time I have represented Switzerland.
“I have already begun rehabilitation in the hopes of returning to the tour later this summer. I wish the entire Swiss team the best of luck and I will be rooting hard from a far. As always Hopp Schwiz!”
Federer, who missed the 2016 Rio de Janeiro Games due to his left knee, underwent two right knee surgeries in 2020 after the Australian Open.
He returned to the Tour in Doha in March this year and has a 9-4 match record from five tournament outings, with his best result being a run to the Wimbledon quarter-finals (l. to Hurkacz).
The 28-time ATP Masters 1000 champion won a doubles gold medal with Stan Wawrinka in Beijing in 2008 and a singles silver medal (l. to Murray) in London in 2012.