The area around Budapest may have been settled as early as the Neolithic era. Aquincum, the Roman capital of Lower Pannonia, was near the modern Óbuda, and Pest developed around another Roman town. Both cities were destroyed by Mongols in 1241, but in the 13th cent. King Béla IV built a fortress (Buda) on a hill around there, and in the 14th cent. Emperor Sigismund built a palace for the Hungarian rulers. Buda became the capital of Hungary in 1361, reaching its height as a cultural center under Matthias Corvinus. Pest fell to the Turks in 1526, Buda in 1541.
When Charles V of Lorraine conquered them for the Hapsburgs in 1686, both Buda and Pest were in ruins. They were resettled, Buda with Germans, Pest with Serbs and Hungarians. Buda, a free royal town after 1703, had a renaissance under Maria Theresa, who built a royal palace and in 1777 transferred to Buda the university founded in 1635 by Peter Pazmany at Nagyzombat. The university was later moved (1784) to Pest. In the 19th cent. Pest flourished as an intellectual and commercial center; after the flood of 1838, it was rebuilt on modern lines. Buda became largely a residential sector.
After the union of Buda and Pest in 1873, the united city grew rapidly as one of the two capitals of the Austro-Hungarian monarchy. The city was by 1917 Hungary's leading commercial center and was already ringed by industrial suburbs. Also a beautiful city, Budapest became famed for its literary, theatrical, and musical life and attracted tourists with its mineral springs, its historic buildings, and its parks. Especially notable is the large municipal park and the showplace of Margaret Island (Hung. Margit Sziget ), in the Danube, where St. Margaret, daughter of Béla IV, had lived in a convent.
With the collapse of the Austro-Hungarian monarchy (Oct., 1918), Hungary, under Count Michael Karolyi, was proclaimed an independent republic. Budapest became its capital. When Karolyi resigned (Mar., 1919) the Communists, led by Béla Kun, gained temporary control of the city and established a Soviet republic in Hungary; but his troops were defeated in July, and Budapest was occupied and looted by Romanian forces. In Nov., 1919, Budapest was seized by forces of Admiral Horthy, who in Mar., 1920, was proclaimed regent of Hungary.
Horthy allied Hungary with Germany in World War II until Oct., 1944, and that same month German troops occupied Budapest. After a 14-week siege the city fell (Feb., 1945) to Soviet troops. Almost 70% of Buda was destroyed or heavily damaged, including the royal palace and the Romanesque Coronation Church. When Hungary was proclaimed a republic (Jan., 1946), Budapest became its capital. In 1948 the Hungarian Communists, backed by Soviet troops, seized control of Hungary and proclaimed it (Aug., 1949) a people's republic. Budapest was the center of a popular uprising against the Hungarian Communist regime in Oct.–Nov., 1956 (see Hungary).