Kings of Scotland have held a castle on the rock from the 11th century, when Malcolm III reigned, and over the centuries kings lived in it, soldiers garrisoned it, and it held weapons, the state treasure, a mint and prisoners. It is home to the Honours of Scotland, and the Old and New Towns of Edinburgh, which UNESCO inscribed as a World Heritage Site in 1995, are described as dominated by it.

Visitors arrive across the Esplanade, the sloping parade ground where the Royal Edinburgh Military Tattoo is staged each August, its climax a lone piper on the battlements. The 1888 Gatehouse carries statues of Robert the Bruce and William Wallace, and from there a road built for moving cannon in 1464 winds up past the Half Moon Battery to the Portcullis Gate. Few buildings are older than the Lang Siege of 1573, when artillery wrecked most of the medieval defences; two storeys of the royal David's Tower survive buried inside the Half Moon Battery, its walls still scarred by that bombardment.

At the summit stands St Margaret's Chapel, a small 12th-century building raised by David I in memory of his mother, Saint Margaret, who died at the castle in 1093; it is the oldest building in the castle. In front of it rests Mons Meg, a 15th-century siege gun made in Flanders and given to James II in 1457, with some of its huge stone balls beside it. Nearby, a small 19th-century cemetery holds the graves of the soldiers' regimental mascot dogs.

Crown Square, laid out in the 15th century over great stone vaults, is the heart of the castle. On its east side the Royal Palace holds the small room where Mary, Queen of Scots, gave birth to James VI on 19 June 1566, and the Crown Room, built in 1615 for the crown, sceptre and sword of state. Sir Walter Scott broke into this sealed room in 1818 and found the regalia, which had been out of sight since the union with England in 1707. The Stone of Scone, on which Scottish monarchs were crowned, has been kept here since its return to Scotland in 1996. The Great Hall on the south side, completed early in the 16th century, keeps an original hammerbeam roof, and the north side is taken up by the Scottish National War Memorial, designed by Sir Robert Lorimer and opened in 1927.

Lower down, the National War Museum of Scotland covers 400 years of Scottish military history, and the castle also houses the regimental museums of the Royal Scots and the Royal Scots Dragoon Guards. From Mills Mount Battery on the north face the One O'Clock Gun is fired as a time signal, a custom begun in 1861 for ships in Leith harbour and the Firth of Forth.