Zagreb was first mentioned in 1094, but at that point it existed as two different cities: Kaptol in the east, containing the Cathedral and mostly residents from the clergy, and Gradec in the west, most inhabited by merchants and labourers.
Between the 16th and 18th centuries, there was a lot of cooperation between these cities, but they did not form a whole, even though they functioned as the political centre of Croatia, Slavonia, and Dalmatia. In 1851 the cities were put together by count Josip Jelačić, who was honoured for this by naming the main square after him. During the 17th and 18th centuries, Zagreb was plagued by fires and the plague.
In the 19th century Zagreb was the centre of the Croatian National Revival, and some of the more important cultural and historical institutions were founded. In 1880 the city fell victim to a large earthquake, in which a lot of buildings were destroyed. Between this earthquake and the first world war, Zagreb developed very well, and it got the characteristic form it has now. During and in between the world wars the city developed further, and it became the capital of the Independent Republic of Croatia (1945-1990) and later the Socialist Republic Croatia, on of the six republic within the Socialist Federal Republic of Yugoslavia. After the second world war, the city developed further in terms of size and infrastructure: the tracks were expanded, and the international Pleso airport was built.
Between 1991 and 1995, the Croatian War of Independence took place. Zagreb was the site of some battles, but remained largely unharmed. In May 1995, it became the target of two Serbian rocket attacks, which led to a lot of damage, victims, and some deaths.
Unfortunately, a large earthquake struck Zagreb again in 2020, causing a lot of damage. The Cathedral of Zagreb lost one of the crosses on its towers. It was the largest earthquake since the one in 1880.