The Beijing city wall was a series of fortifications built between the early 15th century and 1553. The Inner city wall was 24 kilometres (15 mi) long and 15 metres (49 ft) high, with a thickness of 20 metres (66 ft) at ground level and 12 metres (39 ft) at the top. It had nine gates. This wall stood for nearly 530 years, but in 1965 it was removed to allow construction of the 2nd Ring Road and the Line 2, Beijing Subway. Only one part of the wall is extant, in the southeast, just south of Beijing Railway Station. The Outer city walls had a perimeter of approximately 28 kilometres (17 mi). The entire enclosure of the Inner and Outer cities formed a "凸" shape with a perimeter of nearly 60 kilometres (37 mi).
Beijing was a location of the capital during the last three Chinese imperial dynasties (the Yuan, Ming, and Qing). It was also secondary capital to two northern dynasties (the Liao and Jin), and is therefore often referred to as an ancient capital of five dynasties. It had an extensive fortification system, consisting of the Forbidden City, the Imperial city, the Inner city, and the Outer city. Fortifications included gate towers, gates, archways, watchtowers, barbicans, barbican towers, barbican gates, barbican archways, sluice gates, sluice gate towers, enemy sighting towers, corner guard towers, and a moat system. It had the most extensive defense system in Imperial China.
After the collapse of the Qing Dynasty in 1911, Beijing's fortifications were gradually dismantled. The Forbidden city has remained largely intact, becoming the Palace Museum. Some fortifications remain intact, including Tiananmen, the gate tower and watchtower at Zhengyangmen, the watchtower at Deshengmen, the southeastern corner guard tower, and a section of the Inner city wall near Chongwenmen. The latter two components now form the Ming City Wall Relics Park. Nothing of the Outer city remains intact. Yongdingmen was completely reconstructed in 2004.