structural:expansion
Early history

The first settlement on the territory of Budapest was built by Celts before 1 AD. It was later occupied by the Romans. The Roman settlement – Aquincum – became the main city of Pannonia Inferior in 106 AD. At first it was a military settlement, and gradually the city rose around it, making it the focal point of the city's commercial life. Today this area corresponds to the Óbuda district within Budapest. The Romans constructed roads, amphitheaters, baths and houses with heated floors in this fortified military camp. The Roman city of Aquincum is the best-conserved of the Roman sites in Hungary. The archaeological site was turned into a museum with indoor and open-air sections.

The Magyar tribes led by Árpád, forced out of their original homeland north of Bulgaria by Tsar Simeon after the Battle of Southern Buh, settled in the territory at the end of the 9th century displacing the founding Bulgarian settlers of the towns of Buda and Pest, and a century later officially founded the Kingdom of Hungary. Research places the probable residence of the Árpáds as an early place of central power near what became Budapest. The Tatar invasion in the 13th century quickly proved it is difficult to defend a plain. King Béla IV of Hungary, therefore, ordered the construction of reinforced stone walls around the towns and set his own royal palace on the top of the protecting hills of Buda. In 1361 it became the capital of Hungary.

The cultural role of Buda was particularly significant during the reign of King Matthias Corvinus. The Italian Renaissance had a great influence on the city. His library, the Bibliotheca Corviniana, was Europe's greatest collection of historical chronicles and philosophic and scientific works in the 15th century, and second in size only to the Vatican Library. After the foundation of the first Hungarian university in Pécs in 1367 (University of Pécs), the second one was established in Óbuda in 1395 (University of Óbuda). The first Hungarian book was printed in Buda in 1473. Buda had about 5,000 inhabitants around the year 1500.

The Ottomans conquered Buda in 1526, as well as in 1529, and finally occupied it in 1541. The Ottoman Rule lasted for more than 150 years. The Ottoman Turks constructed many prominent bathing facilities within the city. Some of the baths that the Turks erected during their rule are still in use 500 years later, including Rudas Baths and Király Baths. By 1547 the number of Christians was down to about a thousand, and by 1647 it had fallen to only about seventy. The unoccupied western part of the country became part of the Habsburg monarchy as Royal Hungary.

In 1686, two years after the unsuccessful siege of Buda, a renewed campaign was started to enter Buda. This time, the Holy League 's army was twice as large, containing over 74,000 men, including German, Croat, Dutch, Hungarian, English, Spanish, Czech, Italian, French, Burgundian, Danish and Swedish soldiers, along with other Europeans as volunteers, artillerymen, and officers. The Christian forces seized Buda, and in the next few years, all of the former Hungarian lands, except areas near Temesvár (Timișoara), were taken from the Turks. In the 1699 Treaty of Karlowitz, these territorial changes were officially recognized as the end of the rule of the Turks, and in 1718 the entire Kingdom of Hungary was removed from Ottoman rule.