The Sixteen Kingdoms, less commonly the Sixteen States, was a chaotic period in Chinese history from AD 304 to 439 when the political order of northern China fractured into a series of short-lived dynastic states. The majority of these states were founded by the "Five Barbarians": non-Han peoples who had settled in northern and western China during the preceding centuries, and had launched a series of rebellions and invasions against the Western Jin dynasty in the early 4th century. However, several of the states were founded by Han people, and all of the kingdoms—whether ruled by Xiongnu, Xianbei, Di, Jie, Qiang, Han, or others—took on Han-style dynastic names. The states frequently fought against both one another and the Eastern Jin dynasty, which succeeded the Western Jin in 317 and ruled southern China. The period ended with the unification of northern China in 439 by the Northern Wei, a dynasty established by the Xianbei Tuoba clan. This occurred 19 years after the Eastern Jin ended in 420, and was replaced by the Liu Song dynasty. Following the unification of the north by Northern Wei, the Northern and Southern dynasties era of Chinese history began.
The term "Sixteen Kingdoms" was first used by the 6th-century historian Cui Hong in the Spring and Autumn Annals of the Sixteen Kingdoms and refers to the five Liangs (Former, Later, Northern, Southern and Western), four Yans (Former, Later, Northern, and Southern), three Qins (Former, Later and Western), two Zhaos (Former and Later), Cheng Han and Xia. Cui Hong did not count several other kingdoms that appeared at the time including the Ran Wei, Zhai Wei, Chouchi, Duan Qi, Qiao Shu, Huan Chu, Tuyuhun and Western Yan. Nor did he include the Northern Wei and its predecessor Dai, because the Northern Wei is considered to be the first of the Northern Dynasties in the period that followed the Sixteen Kingdoms.
Due to fierce competition among the states and internal political instability, the kingdoms of this era were mostly short-lived. For seven years from 376 to 383, the Former Qin briefly unified northern China, but this ended when the Eastern Jin inflicted a crippling defeat on it at the Battle of Fei River, after which the Former Qin splintered and northern China experienced even greater political fragmentation. The fall of the Western Jin dynasty amidst the rise of non-Han regimes in northern China during the Sixteen Kingdoms period resembles the fall of the Western Roman Empire amidst invasions by the Huns and Germanic tribes in Europe, which also occurred in the 4th to 5th centuries.