A cast of more than 1,200 people from across the globe performed at Edinburgh Castle in front of the royal duo.
The line-up included more than 250 pipers and drummers, five UK military bands and the event’s first Japanese act, as well as major contingents from France, India and the United States.
Prince Charles is known as the Duke of Rothesay in Scotland, and it was the Rothesay flag that flew above the castle once they had arrived.
The Prince, wearing a Royal Navy Admiral uniform, was at the Tattoo as guest of honour, accompanied by William, who is known as the Earl of Strathearn in Scotland.
In front of the sellout show, the royal duo joined a toast to good health, given in Gaelic, with a dram of 10-year-old Glenkinchie whisky, which comes from the nearest distillery to Edinburgh.
The Fanfare Band of the 9th French Marine Infantry Brigade were among the highlights, performing Harder, Better, Faster, Strong with two of the musicians wearing Daft Punk-style helmets.
Some of the fireworks had to be called off due to the strong winds, which also caused the Japan Ground Self Defence Force Central Band’s gong to fall on the drummer halfway through their set.
The royal duo had been given a special pre-Tattoo performance at the Palace of Holyroodhouse earlier on Wednesday.
Acts gave Charles and William a close-up performance in the courtyard.
The Prince and Duke then spent time speaking with performers and posed for a group shot.
William wore black tie with Submariner Dolphins and Golden and Diamond Jubilee medals.
This year’s event, its 68th season, recognises 2017 as being the Year of the Royal Navy and comes before the official naming of the aircraft carrier HMS Prince of Wales later this year.
It is also marking Scotland’s Year of History, Heritage and Archaeology with a second “Splash of Tartan” theme.
Charles and William attended the Tattoo around halfway through its August run.
The first Edinburgh Tattoo took place in 1950, with the first overseas regiment taking part in 1952.
Since then, 48 countries from across six continents have been represented at the Tattoo.
It attracts an annual audience of around 220,000, meaning that more than 14 million people have attended the Tattoo since it began.