The castle has only been partially rebuilt since its demolition in the 17th and 18th centuries. It is located 80 metres (260 ft) up the northern part of the Königstuhl hillside, and thereby dominates the view of the old downtown. It is served by an intermediate station on the Heidelberger Bergbahn funicular railway that runs from Heidelberg’s Kornmarkt to the summit of the Königstuhl.
The earliest castle structure was built before 1214 and later expanded into two castles circa 1294; however, in 1537, a lightning-bolt destroyed the upper castle. The present structures had been expanded by 1650, before damage by later wars and fires. In 1764, another lightning-bolt caused a fire which destroyed some rebuilt sections.
After his loss at the Battle of White Mountain on 8 November 1620, Frederick V was on the run as an outlaw and had to release his troops prematurely, leaving the Palatinate undefended against General Tilly, the supreme commander of the Imperial and Holy Roman Empire’s troops. On 26 August 1622, Tilly commenced his attack on Heidelberg, taking the town on 16 September, and the castle few days later.
When the Swedes captured Heidelberg on 5 May 1633 and opened fire on the castle from the Königstuhl hill behind it, Tilly handed over the castle. The following year, the emperor’s troops tried to recapture the castle, but it was not until July 1635 that they succeeded. It remained in their possession until the Peace of Westphalia ending the Thirty Years War was signed. The new ruler, Charles Louis (Karl Ludwig) and his family did not move into the ruined castle until 7 October 1649.
Victor Hugo summarized these and the following events:
|“||In 1619, Frederick V, then a young man, took the crown of the kings of Bohemia, against the will of the emperor, and in 1687, Philip William, Count Palatine, by then an old man, assumes the title of prince-elector, against the will of the king of France. This was to cause Heidelberg battles and never-ending tribuluations, the Thirty Years War, Gustav Adolfs Ruhmesblatt and finally the War of the Grand Alliance, the Turennes mission. All of these terrible events have blighted the castle. Three emperors, Louis the Bavarian, Adolf of Nassau, and Leopold of Austria, have laid siege to it; Pio II condemned it; Louis XIV wreaked havoc on it.||”|
|— quoted from Victor Hugo: “Heidelberg“|
The question of whether the castle should be completely restored was discussed for a long time. In 1868, the poet Wolfgang Müller von Königswinter argued for a complete reconstruction, leading to a strong backlash in public meetings and in the press.
In 1883, the Grand Duchy of Baden established a “Castle field office”, supervised by building director Josef Durm in Karlsruhe, district building supervisor Julius Koch and architect Fritz Seitz. The office made a detailed plan for preserving or repairing the main building. They completed their work in 1890, which led a commission of specialists from across Germany to decide that while a complete or partial rebuilding of the castle was not possible, it was possible to preserve it in its current condition. Only the Friedrich Building, whose interiors were fire damaged, but not ruined, would be restored. This reconstruction was done from 1897 to 1900 by Karl Schäfer at the enormous cost of 520,000 Marks.