In the early 5th century, China entered a period known as the Northern and Southern dynasties, in which parallel regimes ruled the northern and southern halves of the country. In the south, the Eastern Jin gave way to the Liu Song, Southern Qi, Liang and finally Chen. Each of these Southern Dynasties were led by Han Chinese ruling families and used Jiankang (modern Nanjing) as the capital. They held off attacks from the north and preserved many aspects of Chinese civilization, while northern barbarian regimes began to sinify.
In the north, the last of the Sixteen Kingdoms was extinguished in 439 by the Northern Wei, a kingdom founded by the Xianbei, a nomadic people who unified northern China. The Northern Wei eventually split into the Eastern and Western Wei, which then became the Northern Qi and Northern Zhou. These regimes were dominated by Xianbei or Han Chinese who had married into Xianbei families.
In 589, the Sui dynasty united China once again, ending a prolonged period of division in Chinese history. In the nearly four centuries between the Han and Sui dynasties, the country was united for only 24 years during the Western Jin.
During this period, the process of sinicization accelerated among the non-Chinese arrivals in the north and among the indigenous people in the south. This process was also accompanied by the increasing popularity of Buddhism (introduced into China in the 1st century) in both northern and southern China and Daoism gaining influence as well, with two essential Daoist canons written during this period.
Despite the division of the country, Buddhism spread throughout the land. In southern China, fierce debates about whether Buddhism should be allowed were held frequently by the royal court and nobles. Finally, towards the end of the Southern and Northern Dynasties era, Buddhists and Taoists reached a compromise and became more tolerant of each other.
Notable technological advances occurred during this period. The invention of the stirrup during the earlier Jin dynasty (265–420) helped spur the development of heavy cavalry as a combat standard. Historians also note advances in medicine, astronomy, mathematics, and cartography. Intellectuals of the period include the mathematician and astronomer Zu Chongzhi (429–500).