'After consultation with my team and doctors, I decided to take the difficult decision to withdraw from both tournaments,' Federer said in a statement. 'This will allow me a chance to give my body a chance to rest, rehabilitate and recover from a physically challenging year.'
This year's winner of French Open and Wimbledon titles added: 'I'm disappointed that I have to withdraw from Tokyo and Shanghai as they are two of my favourite cities. The fans have been great to me over the years.'
The Tokyo event is set to feature US Open champion Juan Del Potro, who beat Federer a fortnight ago in the New York final.