Towards the end of the Tang Dynasty, the court experienced increasing upheaval as a result of wars between local warlords, the usurpation of power by eunuchs, and sectarian strife among court officials. The year when Tang Emperor Yizong succeeded to the throne (859), a peasant uprising erupted in eastern Zhejiang; eight years later, a mutiny broke out in Guilin. Although both rebellions were suppressed by the court, antagonistic feelings among the common people rose higher and higher, and renewed uprisings grew larger and larger in scale.
In 875 Wang Xianzhi, a salt smuggler from Puzhou Prefecture (today's east Puxian County, Shandong Prefecture), together with the brothers Shang Jun and Shang Rang, led thousands of peasants in an uprising. Wang proclaimed himself to be "General of Justice and Heaven," "Commander-in- Chief of All Heroes." In the public bulletin, Wang sternly condemned court politics manipulated by wicked officials, as well as the heavy taxes and unjust awards and punishments. The rebel forces seized Caozhou (today's Caoxian County, Shandong Province) and Puzhou Prefecture, and their ranks swelled to tens of thousands. Then Huang Chao from Yuanju (northwest of today's Caoxian County), with his eight brothers, roused thousands of local peasants to take up arms in response. The two forces joined together, and an earth-shaking uprising was unleashed.
At the early stages, Wang Xianzhi was the supreme commander. The rebel forces adopted the strategy of roving warfare, and swept from (today's) southern Shandong to western Henan provinces, and then to eastern Hubei. Later, the peasant forces became divided after the two leaders had a disagreement. Wang Xianzhi and the Shang brothers led their troops in storming some prefectures and counties; he, however, asked the Tang commander-in-chief, seven times, to accept his terms of surrender, but was turned down. Eventually a telling blow was dealt to the rebels, killing tens of thousands of them, including Wang Xianzhi himself.
After Wang Xianzhi had met his doom, the peasant rebels again joined forces. They made Huang Chao their leader, calling him "General of Storms." At that time, government forces were powerful in the Central Plains. When the peasant troops were about to launch an attack on Henan, the Tang court amassed troop contingents, to encircle and annihilate them. Huang Chao perceived the enemy's intent, and decided to direct his attack at the weak link in their defenses. He led his troops down south, successfully crossed the Yangtze River, fighting their way into eastern Zhejiang. They smashed all resistance along the way, and after a year's expedition, captured Guangzhou. After a period of rest and renewal in Guangzhou, they advanced northward. The Tang court's hastily summoned troops attempted to intercept them along the way, but were all crushed. In 884 Huang Chao and his 600,000 soldiers surged through Tongguan Pass.
The news that peasant troops had occupied Tongguan Pass struck terror into the hearts of those in the Tang court. Tang Emperor Xizong (r. 873-889) and the chief eunuch Tian Lingzi, together with the concubines, fled to Chengdu. The officials who could not manage to escape all walked out of the city walls to surrender. That same afternoon Huang Chao, riding in a golden sedan-chair, followed by his officers and soldiers, marched into Chang'an. People, both old and young, lined the streets to welcome him. Huang Chao's ascension ceremony took place in the Palace of Brightness in Chang'an, and his dynasty was named "Daqi."
However, for a long time the peasant troops had been engaged in roving warfare, and stationed no troops in the places that came into their possession. Before long, Chang'an, formerly under their occupation, fell under attack by government troops. Zhu Wen, a general dispatched by Huang Chao for the defense of Tongzhou Prefecture (today's Dali, Shanxi Province), defected to the Tang court. Huang Chao was forced to retreat to Henan with the rebel forces and was besieged by Zhu Wen and Li Keyong. In 884 Huang Chao failed in his attack on Chenzhou Prefecture (today's Huaiyang, Henan Province). Pursued by government forces, he finally withdrew to Hulang Valley, where he met his heroic death.