The monarch was in Edinburgh for the historic Ceremony of the Keys.
Upon his arrival, the King inspected the Guard of Honour and was welcomed to Edinburgh by Lord Provost Robert Aldridge, where he was symbolically handed the keys to the city.
The Queen Consort accompanied the monarch at the ceremony.
Tradition dictates that the monarch returns them, entrusting their safekeeping to the city’s elected officials.
The Queen had been lying in rest in the Palace’s throne room following her death on Thursday.
The ceremony was last held in June as the Queen arrived in Edinburgh to open a week of traditional events for the royals in Scotland.
The trip followed the Platinum Jubilee celebrations for Elizabeth II.
Following the ceremony, Charles joined the procession of the Queen’s coffin to St Giles’ Cathedral.
The King was joined by his siblings Anne, Andrew and Edward as the Queen’s coffin travelled up the Royal Mile to St Giles’ Cathedral.
The streets were lined with thousands of well-wishers paying their respects.
Members of the royal family then accompanied the King at a special service of thanksgiving to celebrate the Queen’s life.