The history of the castle stretches back to the 9th century (870). The first walled building was the church of Our Lady. The Basilica of Saint George and the Basilica of St. Vitus were founded in the first half of the 10th century. The first convent in Bohemia was founded in the castle, next to the church of St. George. A Romanesque palace was erected here during the 12th century. In the 14th century, under the reign of Charles IV the royal palace was rebuilt in Gothic style and the castle fortifications were strengthened. In place of rotunda and basilica of St. Vitus began building of a vast Gothic church, that have been completed almost six centuries later. During the Hussite Wars and the following decades the Castle was not inhabited.
In 1485, King Ladislaus II Jagello began to rebuild the castle. The massive Vladislav Hall (built by Benedikt Rejt) was added to the Royal Palace. There were also built new defence towers on the northern side of the castle. A large fire in 1541 destroyed large parts of the castle. Under the Habsburgs some new buildings in renaissance style appeared here. Ferdinand I built Belvedere, summer palace for his wife Anne. Rudolph II used Prague Castle as his main residence. He founded the northern wing of the palace, with the Spanish Hall, where his precious artistic collections were exhibited. The Second Prague defenestration in 1618 began the Bohemian Revolt.
During the subsequent wars the Castle was damaged and dilapidated. Many works from the collection of Rudolph II were looted by Swedes in 1648, in the course of the Thirty Years' War. The last major rebuilding of the castle was carried out by Queen Maria Theresa in the second half of the 18th century. Ferdinand V, after abdication in 1848, chose Prague Castle as his home. In 1918 the castle became the seat of the president of the new Czechoslovak Republic. The New Royal Palace and the gardens were renovated by Slovenian architect Jože Plečnik. Renovations continued in 1936 under Plečnik's successor Pavel Janák.