After Xiang Liang's death his nephew Xiang Yu 項羽 took over command. Xiang Yu was very proud of his military abilities and never considered Han Xin as a worthy commander. Disappointed by this treatment, Han Xin changed sides and became a commander of Liu Bang, the king of Han 漢, in 206. Han Xin was recommended to Liu Bang by Xiahou Ying 夏侯嬰 and was appointed General regulating the grain (zhisu jiangjun 治粟將軍), a position in the logistics. Again disappointed, he threatened to leave Liu Bang's camp, but he was then urged by Xiao He 蕭何 to stay, and Liu Bang made him Grand general (da jiangjun 大將軍).
Han Xin, finally in a responsible position, analyzed Xiang Yu's situation and came to the conclusion that he, inspite of being hegemonial king (bawang 霸王), was not supported by a larger part of the population because of his cruel treatment of subordinated and his ruthless method of living off the country. Liu Bang, on the other side, had behaved very respectfully towards the population of the region of Guanzhong 關中 (also known as Sanqin 三秦). These were, at that time, the granaries of the empire, and when Liu Bang seized the control of this region, he had gained an important source of wealth for his further campaigns against Xiang Yu.
Han Xin was a very competent military leader who supported Liu Bang after his defeat in Pengcheng 彭城 (modern Xuzhou 徐州, Jiangsu) in 205 and sent a relief army to be united with Liu Bang's remaining forces in Xingyang 滎陽. In the battle of Yingyang, Han Xin checked Xiang Yu's flank so that he was not able to fully undertage a charge against Liu Bang's weaker lines. During the campaign against Wei Bao 魏豹, the king of Wei 魏, he demonstrated his military tactics, and was also able to crush the kings of Dai 代 (Zhao Xie 趙歇), Zhao 趙 (Chen Yu 陳餘) and Yan 燕 (Zang Tu 臧荼).
In 202, Han Xin was appointed princely counsellor (xiangguo 相國). The next campaign was led against the king of Qi 齊, Tian Guang 田廣. For this victory, Han Xin was made King of Qi. He was in the same year asked to send his troops to Gaixia 垓下 (modern Lingbi 靈壁, Anhui), where the final battle between Liu Bang and Xiang Yu took place, before Xiang Yu, after a temporary of escape, committed suicide.
When Liu Bang declared himself emperor of the Han dynasty (known as Emperor Gaozu 漢高祖, r. 206-195), Han Xin was made king of Chu 楚 but was stipped off his military command. He nevertheless kept a guard and was therefore defamed of planning rebellion. In 201, Liu Bang had Han Xin arrested on suggestion of Chen Ping 陳平, but pardoned him and gave him the less prestigious title of Marquis of Huaiyin 淮陰侯.
In 197, Chen Xi 陳豨, counsellor of the King of Dai, Xin, King of Han 韓王信 (not Han Xin!), rebelled against the Han dynasty. Liu Bang personally led the campaign to quell his rebellion. Han Xin, who had contact with Chen Xi, eventually fearing further consequences for himself, used this situation and planned attacking the capital, where the empress and the crown prince remained unprotected. Han Xin's plot became evident, and Counsellor-in-chief Xiao He urged Empress Lü 呂后 to arrest Han Xin.
Han was ordered to come to court, was seized and executed. Han Xin's death might well have saved the Han dynasty from an early demise.