The short answer
The Habsburgs ruled a shifting collection of lands in central Europe for roughly six centuries. Their base was Austria. Over time they added Bohemia and Hungary, held the title of Holy Roman Emperor almost without interruption from the 15th century to 1806, and, through a Spanish branch, ruled Spain and its overseas possessions. Their last realm was Austria-Hungary, which ended in 1918.
The Austrian heartland and the Holy Roman Empire
The family rose to prominence in the 13th century. Rudolf I was elected king of the Romans in 1273, and his sons were given the duchies of Austria and Styria. Austria became the center of Habsburg power, and Vienna became its main seat.
From the 15th century onward, Habsburgs were chosen as Holy Roman Emperor with very few gaps, until Francis II gave up the title in 1806. The empire was a loose association of many states, and the title carried prestige more than direct control. Habsburg power in practice rested on their own hereditary lands.
Bohemia and Hungary
In 1526 the king of Bohemia and Hungary died fighting the Ottomans at the Battle of Mohács. The Habsburg Ferdinand I, who was related to the dead king by marriage, claimed both crowns. Bohemia stayed with the family for the rest of their rule. Hungary was harder: much of it fell under Ottoman control for generations, and the Habsburgs held only a strip of it until reconquest in the late 17th and early 18th centuries.
The Spanish branch and its possessions
Through marriages arranged in the late 15th century, Charles V inherited an enormous range of titles, including Spain, its American territories, the Netherlands and parts of Italy, alongside the Habsburg lands in central Europe. After he stepped down, the family divided into two main branches. The Spanish line, beginning with his son Philip II, ruled Spain and its empire. The Austrian line, beginning with his brother Ferdinand I, kept the central European lands and the imperial title.
The Spanish Habsburg line ended in 1700 with the death of the childless Charles II of Spain, which led to the War of the Spanish Succession.
The Austrian Empire and Austria-Hungary
After the line passed through the marriage of Maria Theresa, the house is often called Habsburg-Lorraine. In 1804 Francis II took the title emperor of Austria, shortly before dissolving the Holy Roman Empire. In 1867 the realm was reorganized as the dual state described in our article on the Habsburg dual monarchy, with the ruler as both emperor of Austria and king of Hungary.
Short-lived and borrowed thrones
Not every Habsburg crown was lasting. Maximilian, a brother of Franz Joseph, accepted the throne of Mexico in 1864 under French sponsorship, and he was executed there in 1867 after the empire collapsed.
Why the map kept changing
Habsburg holdings were often gained through marriage and inheritance rather than conquest, which gave rise to the saying that others waged war while the Habsburgs married. The reality was more mixed, with plenty of warfare too. Because the lands were assembled this way, they were diverse in language and law, a feature that helped define both the strengths and the weaknesses of the dynasty. For the wider story, see our overview of the Habsburg royal dynasty.