The Queen had said it was her "sincere wish" that Prince Charles would follow her in the role.
Leaders of the Commonwealth have been discussing the issue at a meeting behind closed doors at Windsor Castle.
The head role is non-hereditary so is not automatically passed on when the Queen dies, with suggestions it might have rotated among the 53 leaders.
In a statement, the leaders said they "recognise the role of the Queen in championing the Commonwealth and its people".
Prime Minister Theresa May and Canadian PM Justin Trudeau had earlier given their backing to Prince Charles.
Speaking at a news conference marking the end of the summit, Mrs May praised the Queen for her "vision and duty" in growing the Commonwealth from eight members to 53.
She said it was "fitting" Prince Charles would succeed her due to his "proud support" of the Commonwealth "for more than four decades".
The leaders also agreed a "blue charter" to protect the ocean from pollution and climate change and a "cyber declaration" to combat online crime and threats.
The meeting during a two-day summit involved 46 heads of Commonwealth governments and foreign ministers from the remaining seven countries.
The Commonwealth represents about 2.4bn people, but critics say the organisation is so disparate that it struggles to know what it is for, BBC royal correspondent Jonny Dymond said.
He also said the news of the prince's appointment would be "of great satisfaction" to the Queen.
Other issues under discussion in London have included trade between the countries with Mrs May saying the leaders agreed to "fight protectionism" to expand intra-Commonwealth trade to $2 trillion by 2030.
The leaders' statement said they had set "specific commitments" which include building peace, promoting gender equality and tackling climate change.
They also said they will work to prevent violent extremism and human trafficking, pledged to halve malaria in Commonwealth countries by 2023 and agreed that all boys and girls should receive at least 12 years of education by 2030.
Meanwhile, the government has indicated it would welcome Zimbabwe's re-entry to the Commonwealth after Robert Mugabe pulled the country out in 2003.
Foreign secretary Boris Johnson said Zimbabwe's government has "made impressive progress" under Mr Mugabe's successor, Emmerson Mnangagwa, but the country would have to deliver "free and fair elections" for the people in July.
Rwanda has been chosen to host the next summit in 2020.