"Buckingham Palace is pleased to confirm that the Duke of Sussex will attend the coronation service at Westminster Abbey on 6th May," a palace statement said, using Harry's official title.
"The Duchess of Sussex will remain in California with Prince Archie and Princess Lilibet."
Harry's attendance is seen as particularly sensitive since the publication of his blockbuster memoir "Spare" in January.
In the explosive autobiography, the 38-year-old prince claimed his elder brother Prince William attacked him during an argument about Meghan, an American former television actress.
It followed a string of high-profile interviews and a six-hour Netflix docu-series in which the couple repeatedly criticized the royals.
In comments that were widely seen as damaging to the royal family, Meghan, who is mixed race, also told US chat show queen Oprah Winfrey in 2021 there had been comments made before Archie's birth about the color of his skin.
The claim prompted William to furiously respond that the royals were "very much not a racist family".
Despite the tensions with the royal family, Charles had reportedly been keen for his younger son to be at the coronation.
The announcement follows weeks of uncertainty over the presence of Harry and Meghan, who have launched a barrage of criticism of the British royal family since announcing they were quitting royal duties in early 2020.
The day of the coronation falls on Archie's fourth birthday.
Archewell, Harry and Meghan's charitable foundation, issued a near identical statement to Buckingham Palace confirming his attendance.
The couple said in early March they had been in email correspondence with the palace over the ceremony but refused to say whether they would be there.
The delay in replying to the invitation had reportedly caused difficulties for organizers given the security considerations for an event due to be attended by numerous foreign dignitaries and heads of state.
The couple have made infrequent visits to the UK since relocating to the United States, including for Harry's grandmother Queen Elizabeth II's funeral in September.
But tensions were visible when Harry and Meghan joined William and his wife Kate on a joint walkabout at Windsor Castle to review floral tributes for the late monarch.
Charles, who ascended to the throne upon his mother's death, will be formally crowned king in a pomp-filled ceremony attended by 2,000 people and watched by a worldwide television audience.
The celebrations for the first coronation since 1953 will feature a star-studded concert with Kylie Minogue and Lionel Richie reportedly set to perform.
A nationwide "Big Lunch" and volunteering initiative, as well as the traditional ceremony and royal processions, are also planned.