During the Tang dynasty (唐朝) and subsequent Five Dynasties (五代), the status of the city of Taiyuan was elevated to be the Northern Capital, hence the name Běidū (北都), and Běijīng (北京, different from present-day Beijing).Taiyuan is an ancient city with more than 2500 years of urban history, dating back from 497 BC.Although, the name Taiyuan had appeared in historic records before, potentially referring to different regions in nowadays southern and central Shanxi, this was the first time Taiyuan was officially used to refer to present-day Taiyuan.In 206 BC, Emperor Gaozu Liu Bang established the Han dynasty.
Later, Zhao Xiangzi (赵襄子) alerted Wei and Han, who both decided to ally with Zhao.
Following the ending of the Jin dynasty, ethnic minority peoples settled a series of short-lived sovereign states in northern China, commonly referred to as Sixteen Kingdoms.
Taiyuan was part of Former Zhao, Later Zhao, Former Qin, Former Yan, Former Qin again, Western Yan, and Later Yan chronologically.
It was the capital or secondary capital (陪都, 别都) of Zhao, Former Qin, Eastern Wei, Northern Qi, Northern Jin, Later Tang, Later Jin, Later Han, Northern Han.
Its strategic location and rich history make Taiyuan one of the economic, political, military, and cultural centers of Northern China.
In 304, Liu Yuan founded the Xiongnu state of Former Zhao, whose army raided the area around Taiyuan for years and eventually obtained Taiyuan in 316.