Beijing means Northern Capital, and it has held that role many times. It first mattered as Yanjing, capital of the state of Yan, about 2,000 years ago. The Khitans made it a capital in 938, and the Mongols took it in 1215. From 1264 Kublai Khan ruled a united China from here under the name Dadu, and the alleys you can still walk, the hutongs, go back to that period.
The Ming first razed the Mongol palaces in 1368 and renamed the place Beiping. Then Zhu Di, the prince who held it, won a succession fight, took the throne as the Yongle Emperor and turned it back into the Northern Capital in 1403. His Forbidden City went up between 1406 and 1420, with the Temple of Heaven and Tiananmen from the same period. By the 15th century the city had more or less the shape it has now, and it is generally believed to have been the largest city in the world for much of the next four hundred years. The Ming emperors are buried in a necropolis north of the city.
In 1644 a rebel army took the city, and 40 days later it left without a fight when the Manchu army arrived. The Qing who followed kept the Ming layout and ruled from the Forbidden City until 1911. They also laid out two palace gardens north-west of the city for summer retreats. Anglo-French troops looted and burned the older one in 1860, and Western powers won the right to station diplomats in the city. In 1900 their legations south of the Forbidden City came under siege in the Boxer Rebellion.
The Qing fell in 1911. Warlords fought over Beijing, and in 1928 the Kuomintang moved the capital to Nanjing and renamed the city Beiping, Northern Peace. It stayed a centre of education and culture. Japan took it in July 1937 after the shooting at the Marco Polo Bridge, southwest of the city. In January 1949 the People's Liberation Army took the city peacefully, and on 1 October Mao Zedong announced the People's Republic from the top of Tiananmen. Beijing became the capital again.
The new government rebuilt the city around its own needs, and a lot of the old fabric went. The Ming city wall came down in the 1960s, and the subway and the 2nd Ring Road took its place. Courtyard houses that had belonged to aristocrats were taken over and poorer families moved in. Then the Cultural Revolution (1966 to 1976) brought Red Guards, who destroyed or damaged more than 70 percent of the city's listed historic sites: 4,922 out of 6,843. The Forbidden City got through.
The reform period began in December 1978. Richard Nixon's 1972 visit was a turning point, and by the 1980s there were supermarkets, fast food and high-rise offices. Ring roads 3 to 6 followed the 2nd, which opened in 1981, and by one 2005 report Beijing had grown to one and a half times its earlier size. Beijing staged the 2008 summer Olympics and the 2022 winter Games, and no other city has done both. Many hutongs gave way to wide boulevards, which is why Beijing feels sprawling in a way Shanghai or Hong Kong do not. The Tiananmen Square protests of 1989 were also among the major events of these years.
Beijing is now tied closer to its neighbours. A strategy launched in 2014 links it with Tianjin and Hebei, and high-speed rail reaches Tianjin in 30 minutes. In 2024 the Central Axis was added to the UNESCO World Heritage list.