The Beatles legend recently teased an appearance at the music festival with a cryptic Wordle-related tweet, and organisers have now confirmed that he will take to the stage at the Somerset event this summer.
US rapper Kendrick Lamar will also headline, as will Billie Eilish, whose name has already been announced.
‘Bad Guy’ singer Eilish will top the bill on the Friday, while Sir Paul — who previously headlined Glastonbury in 2004 — will play on the Pyramid Stage on the Saturday night.
Lamar will close the event on the Sunday.
Other stars taking part in the festival — which runs across a long weekend in June — include Motown legend Diana Ross, Foals, Lorde, Noel Gallagher’s High Flying Birds, Olivia Rodrigo, Wolf Alice and Years & Years.
The line-up includes new acts such as Arlo Parks, Doja Cat, Easy Life, Fontaines DC and Griff alongside more established names including Pet Shop Boys, Crowded House, Primal Scream and Supergrass.
Former Led Zeppelin frontman Robert Plant will appear alongside American country and bluegrass star Alison Krauss following the release of their second collaborative album.
Music fans guessed that Sir Paul would be at Glastonbury after he shared a very odd Wordle score last month.
The star — who was due to perform at the 2020 festival before it was called off because of COVID — tweeted a six-letter score for the online word puzzle, when Wordles are usually five.
Many decided the word was actually “Glasto” and guessed that the score, “Wordle 121 25/6", related to the date of the 79-year-old’s performance.
The festival has not been held for the last two years amid the pandemic.
Tickets for this year’s event are already sold out because they have rolled over from those purchased for the cancelled 2020 festival.
Glastonbury 2022 is scheduled to take place from 22 June to 26 June at Worthy Farm in Somerset.
Additional reporting by PA.
Watch: Billie Eilish tapped to headline the 2022 Glastonbury festival