Yanjing is a historical name for the ancient city of Ji (also known as Jicheng), located in northern China. It currently constitutes the longest continuously inhabited section of modern-day Beijing. The site has been historically significant since at least 1045 BC, with archaeological evidence dating back to the Spring and Autumn period.
The city served as the capital for the ancient states of Ji and Yan until the Qin dynasty unified China in 221 BC. It subsequently functioned as a prefectural capital for Youzhou through various dynasties, including the Han, Three Kingdoms, Western Jin, Sixteen Kingdoms, Northern Dynasties, and Sui. During the Tang dynasty, the city became more exclusively associated with the name Yanjing following the creation of a separate Ji Prefecture in present-day Tianjin.
In later centuries, the area served as the southern capital of the Liao dynasty and the main capital of the Jurchen Jin dynasty. By the 13th century, Kublai Khan established the Yuan dynasty capital adjacent to the north, turning the old city of Ji into a suburb. This site was eventually developed under the Ming and Qing dynasties into the modern city of Beijing.