The reason Liu Bang dared to attack Zhang Han and others was that the state of Qi had already shown signs of discontent; Tian Rong, a descendant of the former Qi royal family, dissatisfied with Xiang Yu, deposed the Qi king appointed by Xiang Yu, took the throne himself, and then loudly declared he would defeat Xiang Yu. With Liu Bang occupying most of the Guanzhong region on one side and Qi's unrest on the other, Xiang Yu was uncertain which threat to suppress first. At this point, Zhang Liang wrote a letter to King Xiang, stating that Liu Bang would be content with just the Guanzhong area and would not dare to make any further advances, but that the other enfeoffed kings all coveted the entire realm and should be dealt with first.
Xiang Yu indeed let his guard down against Liu Bang, focusing all his efforts on attacking the state of Qi. When the Chu and Qi armies clashed, Liu Bang mobilized his forces and marched eastward, using the name of the Righteous Emperor to rally various feudal lords in a campaign against the Hegemon-King of Western Chu.
In the second year of the Han Dynasty (205 BCE), in April, Liu Bang led his army to attack the Chu capital of Pengcheng. At that time, Pengcheng's defenses were lax, as most of the troops had been taken by Xiang Yu to suppress the rebellion of King Tian Rong of Qi. Taking advantage of this opportunity, Liu Bang gathered several hundred thousand troops in Luoyang and divided them into several columns to march on Pengcheng.
The Chu generals Long Ju and Xiang Tuo, stationed in Pengcheng, led troops to resist the Han invasion but encountered Han generals Cao Shen, Guan Ying, and Zhou Bo, who had flanked them from the west; these three quickly crossed the Yellow River at Weijin (present-day Dongming, Shandong), defeated Long Ju and Xiang Tuo at Dingtao, and then captured Huling (southeast of present-day Yutai, Shandong); another Han force advanced from Ye County (southwest of present-day Ye County, Henan) to Yangxia, encircling Pengcheng from the south; the final contingent, led personally by Liu Bang and including generals like Xiahou Ying along with the armies of various feudal lords, captured Waihuang (southeast of present-day Lankao, Henan) southeast of Pengcheng before pushing eastward; along the way, they encountered Peng Yue, who came to pledge allegiance with 30,000 troops, greatly pleasing Liu Bang, who appointed Peng Yue as Chancellor of Wei and sent him to attack the Liang region (northeastern present-day Henan); shortly thereafter, Liu Bang easily entered Pengcheng.
While Xiang Yu was engaged in warfare in the state of Qi, he learned that his capital had been captured by Liu Bang. Furious beyond measure, he realized his main army was still tied up in the conflict with Qi, so he decided to take a gamble. Leading 30,000 elite soldiers on a forced march day and night, he first seized Xiao County, cutting off Liu Bang's escape routes. Then, as Liu Bang's forces were celebrating wildly within Pengcheng, Xiang Yu launched a surprise attack. Inspired by his one-against-a-hundred valor, his troops fought with great fervor. By noon, after clashing from early morning, they had already routed the Han army. Liu Bang and his men scrambled to hide around the Gu and Si Rivers (west of present-day Xuzhou, Jiangsu), but the panicked Han soldiers, pushing and shoving each other, had lost all discipline. The Chu army effortlessly slaughtered over 100,000 of them. The remaining Han forces fled southwest, only to be encircled by the Chu army at Lingbi, forcing over 100,000 Han soldiers to leap into the Sui River. Xiang Yu believed he would surely capture Liu Bang this time, but suddenly a fierce wind, mixed with sand and stones, swept across the battlefield, blinding everyone and stinging their bodies. Seeing this as a sign of heaven's favor, Liu Bang abandoned his main army and fled in haste with just a few cavalrymen. In the Battle of Pengcheng, Liu Bang suffered devastating losses. The feudal lords who had originally allied with him were so intimidated by Xiang Yu's might that they all defected to the Chu side.
In June of the second year of the Han Dynasty, Han Xin defeated the Chu army that had come to wipe out the remaining Han forces, after which Liu Bang recruited more soldiers, rested and recuperated in Xingyang, and continued to contend with Xiang Yu. Zhang Han had been fighting against Liu Bang all along, but by July, he could no longer hold out and was defeated by Liu Bang, ultimately committing suicide.
Liu Bang also sent people to persuade Ying Bu to leave Xiang Yu, while Peng Yue kept causing small disturbances around the Chu army, leaving Xiang Yu with a splitting headache. In the north, the state of Wei was captured by Han Xin, King Bao of Wei was taken prisoner, and the states of Dai and Zhao soon fell one after another.

Soon after, Xiang Yu began his counterattack, and the Chu army laid siege to Xingyang, cutting off all escape routes. This panicked Liu Bang, who had no idea how to break free. Fortunately, one of his advisors, Chen Ping—who had also defected from Chu—offered a plan. He told Liu Bang that Fan Zeng, Xiang Yu's most capable aide, was the key to the Chu army's strength. If they could sow discord to make Xiang Yu lose trust in Fan Zeng, the Chu forces would become vulnerable. Liu Bang then spread rumors that Fan Zeng was secretly in contact with the Han state. Xiang Yu fell for the trick once again, and Fan Zeng, furious and humiliated, claimed he was old and wanted to return home. He hastily left Xiang Yu, but fell ill on the road and died before reaching his destination.
Fan Zeng's departure weakened the Chu army's strength, and Liu Bang's ruse of sending someone else to pretend to surrender did not arouse Xiang Yu's suspicion; seizing this opportunity, Liu Bang finally escaped from the encirclement at Xingyang. After escaping, Liu Bang joined forces with Han Xin to capture Chenggao, and then forced the main Chu army to leave Xingyang to defend Xiapi, which was being invaded by Peng Yue.
In July 204 BC, Xingyang and Chenggao were again occupied by Xiang Yu.
In November 204 BC, Liu Bang recruited a large number of new troops and attacked Suiyang (south of present-day Shangqiu, Henan) together with Peng Yue, forcing Xiang Yu to mobilize his army to fight; as a result, Chenggao fell into Liu Bang's hands once again, and the defending general Cao Jiu was killed by the Han army.
Xiang Yu defeated Peng Yue at Suiyang, but his army suffered heavy losses. Without pausing to resupply his troops with equipment, he rushed nonstop to Guangwu (present-day north of Xingyang, Henan) to station his forces, facing the Han army across the field. Unfortunately, Han Xin and Guan Ying had already cut off Xiang Yu's retreat, leaving the Chu army with dwindling food supplies and a severe shortage of soldiers' uniforms. In this desperate situation, Xiang Yu had no choice but to negotiate peace with Liu Bang, agreeing to divide the realm in half along the Hong Canal, with the west belonging to the Han and the east to the Chu.
In 203 BC, Xiang Yu withdrew his forces. After seeing the Chu army leave, Liu Bang also planned to return to Guanzhong, but Zhang Liang and Chen Ping disagreed, believing that the Chu army's retreat was the perfect opportunity for the Han army to attack. Seeing that Chu's forces had greatly weakened and lost popular support, they argued it was better to press the advantage and destroy Chu, securing the entire realm for Han. Xiang Yu never expected Liu Bang to tear up the treaty and take advantage of his weakness; the Chu army fought while retreating to Gaixia. Liu Bang then gathered Han Xin, Peng Yue, and many other generals, leading 700,000 troops to besiege Xiang Yu.
After several consecutive battles, the Chu army's soldiers were utterly exhausted, with only about one hundred thousand men remaining. Under the tight encirclement of the Han army, Xiang Yu's cavalry and the infantry behind were separated. The Han army first feigned a retreat, luring Xiang Yu and his cavalry into pursuit, then attacked the infantry from both sides. In this battle, the Chu army lost forty thousand men, with another twenty thousand captured. Fewer than twenty thousand soldiers remained by Xiang Yu's side. Forced to retreat, Xiang Yu withdrew to Gaixia to rest and regroup. That night, as Xiang Yu drank in his tent with his concubine Yu Ji by his side, he suddenly heard Chu songs coming from outside the tent, echoing from all directions. Startled, Xiang Yu believed he had no way out and sang mournfully:
His strength plucked up mountains, his spirit overshadowed the world,
The times are unfavorable, and the steed cannot flee.
The steed won't gallop, what can be done?
Yu, oh Yu, what is to be done with you?
This is the famous "Song of Gaixia" that would be remembered through the ages. Lady Yu realized that Xiang Yu now had no choice but to fight to the death and break out of the encirclement, and that she was nothing but a burden to him. So after Xiang Yu finished singing, Lady Yu sorrowfully bid him farewell, then drew her sword and slit her own throat. After Lady Yu's death, Xiang Yu led eight hundred elite soldiers to break through the siege—this was precisely Liu Bang's plan, using the songs to force Xiang Yu to charge out. Along the way, Xiang Yu killed many Han generals and soldiers, but Han Xin, Zhou Bo, Fan Kuai, and others kept pursuing him relentlessly. After many twists and turns, Xiang Yu finally reached the banks of the Wu River, with only twenty-six of his eight hundred soldiers remaining. A boat was moored at the riverbank, and the local warden of Wu River said to Xiang Yu, "Though the land east of the river is small, it can still allow you, my king, to rest and recover. Please come with me across the river immediately."
Xiang Yu looked up at the sky and laughed heartily, saying to the ferryman, "Back then, I led thousands of young men from Jiangdong across the river to conquer the realm; now, I am the only one returning. Even if the elders of Jiangdong do not blame me, I am too ashamed to face them." As he finished speaking, the Han army had already caught up. Xiang Yu and his soldiers fought desperately, their eyes bloodshot with rage. All twenty-six soldiers died in battle, and Xiang Yu, covered in wounds, finally drew his sword and took his own life.
In 202 BCE, after his victory over Chu, Liu Bang enfeoffed Han Xin as the King of Chu and Peng Yue as the King of Yue. His followers then urged Liu Bang to ascend the throne and unify the realm. Liu Bang initially declined, but his subordinates argued that the safety of the empire and the well-being of the people required him to accept, so he finally agreed.
In February 202 BC, Liu Bang proclaimed his accession in Dingtao, establishing the Han Dynasty.