McCartney last played Glastonbury in 2004, delivering a set of songs covering the Beatles era, his later work solo and with Wings. The 77-year-old star tweeted: "Hey Glasto - excited to be part of your Anniversary celebrations. See ya next summer!"
The festival takes over Worthy Farm in southwest England from June 24-28. The 135,000 tickets sold within an hour of going on sale last month.