Hamburg, officially the Free and Hanseatic City of Hamburg,. is the second-largest city in Germany after Berlin and sixth-largest city in the European Union, with a population of over 1.9 million. The Hamburg Metropolitan Region has a population of over 5.1 million and is the tenth-largest metropolitan region by GDP in the European Union. At the base of the Jutland Peninsula, the -long Elbe estuary begins in Hamburg, at the confluence of the Alster and Bille. Hamburg is one of Germany's three city-states alongside Berlin and Bremen, and is surrounded by Schleswig-Holstein to the north and Lower Saxony to the south. The Port of Hamburg is Germany's largest and Europe's third-largest, after Rotterdam and Antwerp. The local dialect is a variant of Low Saxon.

The official name reflects Hamburg's history as a member of the medieval Hanseatic League and a free imperial city of the Holy Roman Empire. Before the 1871 unification of Germany, it was a fully sovereign city state, and before 1919 formed a civic republic headed constitutionally by a class of hereditary Grand Burghers, or . Beset by disasters such as the Great Fire of Hamburg in 1842, the Allied fire-bombing of the city in 1943, and North Sea flood of 1962, the city has managed to recover and emerge wealthier after each catastrophe. Major regional broadcaster NDR, the printing and publishing firm and the newspapers and are based in the city. Hamburg is the seat of Germany's oldest stock exchange and the world's oldest merchant bank, Berenberg Bank. Media, commercial, logistical, and industrial firms with significant locations in the city include multinationals Airbus, , , , Lufthansa and Unilever.

Hamburg is also a major European science, research, and education hub, with several universities and institutions, including the University of Hamburg, and the Deutsches Elektronen-Synchrotron Laboratory DESY. The city enjoys a very high quality of living, being ranked 28th in the 2024 Mercer Quality of Living Survey. Hamburg hosts specialists in world economics and international law, including consular and diplomatic missions such as the International Tribunal for the Law of the Sea, the EU-LAC Foundation, and the UNESCO Institute for Lifelong Learning, multipartite international political conferences and summits such as Europe and China and the G20. Former German chancellors Helmut Schmidt and Angela Merkel were both born in Hamburg. The former Mayor of Hamburg, Olaf Scholz, was chancellor from December 2021 until May 2025.

Hamburg is a major international and domestic tourist destination. The and were declared World Heritage Sites by UNESCO in 2015.Media release on the website of Hamburg Marketing, retrieved on 19 March 2016. Hamburg's rivers and canals are crossed by around 2,500 bridges, making it the city with the highest number of bridges in Europe, and Hamburg is also home to five of the world's 29 tallest churches, making it the city with the greatest number of churches surpassing worldwide. Aside from its rich architectural heritage, the city is also home to notable cultural venues such as the and concert halls. It gave birth to movements like and paved the way for bands including the Beatles. Hamburg is also known for several theatres and a variety of musical shows. St. Pauli's is among the best-known European red-light districts.

History

Origins Claudius Ptolemy (2nd century AD) reported the first name for the vicinity as Treva.

Etymology The name Hamburg comes from the first permanent building on the site, a castle which the Emperor Charlemagne ordered constructed in AD 808. It rose on rocky terrain in a marsh between the Alster and the Elbe rivers as a defence against Slavic incursion, and acquired the name Hammaburg, burg meaning castle or fort. The origin of the Hamma term remains uncertain, but its location is estimated to be at the site of today's Hammaburgplatz.

Medieval Hamburg

In 834 AD, Hamburg was established as the seat of a bishopric. Its first bishop, Ansgar, later known as the Apostle of the North, founded the city's early Christian institutions. Two years later, Hamburg was linked with Bremen to form the Bishopric of Hamburg-Bremen.Verg (2007), p.15

Hamburg faced repeated destruction in its early centuries. In 845, a fleet of 600 Viking ships sailed up the River Elbe and destroyed the town, which then had about 500 inhabitants. In 1030, King Mieszko II Lambert of the Kingdom of Poland burned the city, and in 1201 and 1214 it was raided and occupied by Valdemar II of Denmark. The Black Death reached Hamburg in 1350, killing at least 60% of its population, and the city also suffered several major fires in the medieval period.

A major turning point came in 1189 when Frederick Barbarossa granted Hamburg the status of a Free Imperial City. The imperial charter included tax-free passage down the Lower Elbe to the North Sea (a form of free-trade zone). In 1265, an allegedly forged charter was presented to or by the Rat (council) of Hamburg.Verg (2007), p. 26

Hamburg's location between the North Sea and Baltic Sea trade routes helped it become a major port in Northern Europe. Its 1241 alliance with Lübeck is regarded as the founding moment of the Hanseatic League. On 8 November 1266, a contract between Henry III of England and Hamburg's merchants allowed them to establish a hanse in London — the first recorded use of the word for the League's trading guild.Verg (2007), p. 30

In 1270, Jordan von Boitzenburg, solicitor to the Senate of Hamburg, wrote the Ordeelbook, the first description of civil, criminal and procedural law for a German city in the German language. On 10 August 1410, civil unrest resulted in a negotiated compromise (German: Rezeß), considered the first constitution of Hamburg.Verg (2007), p. 39

On 25 February 1356 — the first day of spring in medieval reckoning — the Matthiae-Mahl feast for Hanseatic League cities was celebrated for the first time. It continues today as the world's oldest ceremonial meal.

Early modern period

In 1529, the city embraced Lutheranism, and it received Reformed refugees from the Netherlands and France.

When Jan van Valckenborgh introduced a second layer to the fortifications to protect against the Thirty Years' War in the seventeenth century, he extended Hamburg and created a "New Town" (Neustadt) whose street names are still based upon the grid system of roads he introduced.History of the area , accessed 3 November 2012

From the autumn of 1696 to the spring of 1697, the Company of Scotland trading to Africa and the Indies was active in Hamburg. While it was unsuccessful in raising capital locally, it commissioned the construction of four vessels in the port. The Caledonia, a ship of 600 tons with 56 guns, and the Instuaration (later renamed the St. Andrew), a vessel of 350 tons, were launched in March 1697.Watt, Douglas (2024), The Price of Scotland: Darien, Union and the Wealth of Nations, Luath Press Limited, Edinburgh, pp. 97 - 103 & 117 - 121,

Upon the dissolution of the Holy Roman Empire in 1806, the Free Imperial City of Hamburg was not incorporated into a larger administrative area while retaining special privileges (mediatised), but became a sovereign state with the official title of the Free and Hanseatic City of Hamburg. Hamburg was briefly annexed by Napoleon I to the First French Empire (1804–1814/1815). Russian forces under General Bennigsen finally freed the city in 1814. Hamburg re-assumed its pre-1811 status as a city-state in 1814. The Congress of Vienna of 1815 confirmed Hamburg's independence and it became one of 39 sovereign states of the German Confederation (1815–1866).

In 1842, about a quarter of the inner city was destroyed in the Great Fire of Hamburg. The fire started on the night of 4 May and was not extinguished until 8 May. It destroyed three churches, the town hall, and many other buildings. 51 people were killed and an estimated 20,000 people were left homeless. Reconstruction took more than 40 years.

After periodic political unrest, particularly during the Revolutions of 1848, Hamburg adopted in 1860 a semidemocratic constitution that provided for the election of the Senate, the governing body of the city-state, by adult taxpaying males. Other innovations included the separation of powers, the separation of Church and State, freedom of the press, of assembly and association. Hamburg became a member of the North German Confederation (1866–1871) and of the German Empire (1871–1918), and maintained its self-ruling status during the Weimar Republic (1919–1933). Hamburg acceded to the German Customs Union or Zollverein in 1888, the last (along with Bremen) of the German states to join. The city experienced its fastest growth during the second half of the 19th century when its population more than quadrupled to 800,000 as the growth of the city's Atlantic trade helped make it Europe's second-largest port. The Hamburg America Line, with Albert Ballin as its director, became the world's largest transatlantic shipping company around the start of the 20th century. Shipping companies sailing to South America, Africa, India and East Asia were based in the city. Hamburg was the departure port for many Germans and Eastern Europeans to emigrate to the United States in the late 19th and early 20th centuries. Trading communities from all over the world established themselves there.

A major outbreak of cholera in 1892 was badly handled by the city government, which retained an unusual degree of independence for a German city. About 8,600 died in the largest German epidemic of the late 19th century, and the last major cholera epidemic in a major city of the Western world.

Second World War

Hamburg was a within the administrative division of Nazi Germany from 1934 until 1945. The bombing of Hamburg in World War II devastated much of the city and the harbour. On 23 July 1943, the Royal Air Force (RAF) and United States Army Air Force firebombing created a firestorm which spread from the (main railway station) and quickly moved south-east, completely destroying entire boroughs such as Hammerbrook, Billbrook and Hamm South. Thousands of people perished in these densely populated working class boroughs. The raids, codenamed Operation Gomorrah by the RAF, killed at least 42,600 civilians; the precise number is not known. About one million civilians were evacuated in the aftermath of the raids. While some of the boroughs destroyed were rebuilt as residential districts after the war, others such as Hammerbrook were entirely developed into office, retail and limited residential or industrial districts.

The Hamburg Commonwealth War Graves Commission Cemetery is in the greater Ohlsdorf Cemetery in the north of Hamburg.

At least 42,900 people are thought to have perished in the Neuengamme concentration camp (about outside the city in the marshlands), mostly from epidemics and in the destruction of Kriegsmarine vessels housing evacuees at the end of the war.