Emperor Han Wendi 漢文帝 (202-157, r. 180-157 BCE), personal name Liu Heng 劉恆, was one of the first rulers of the Former Han dynasty 前漢 (206 BC-8 CE). He was a son of Liu Bang 劉邦 (Emperor Gaozu 漢高祖, r. 206-195), the founder of the dynasty, and Lady Bo 薄姬.
As son of a concubine of less importance, he was never considered as heir to the imperial throne. He was, nevertheless, made Prince of Dai 代 in 196, a position which he undisputedly held through the reign of his brother, Emperor Hui 漢惠帝 (r. 195-188), and during the reign of Empress Dowager Lü 呂太后 (r. 188-180), the mother of Emperor Hui. When she died, her relatives endangered the continuance of the dynasty (although historian never clearly say whether they tried to replace the Han dynasty). This "disturbance of the Lüs" was quickly ended, and because Emperor Hui had no surviving sons, Liu Heng was the sole claimant to the throne.
As an emperor (known in history as Emperor Wen) he continued the politics of laissez-faire in order to relax the economy. He even further decreased the field tax (tianfu 田賦) to one thirtieth of the harvest and proclaimed a tax suspension for twelve years, as well as a suspension of corvée labour. On the other hand, the government enhanced the construction of canals and dams and encouraged the peasants to cultivate mulberry trees for the production of silk.
An increase in production was stimulated by granting rewards in the shape of military ranks of honour on those delivering grain to the government. Emperor Wen never increased the number of state carts nor that of official court robes. When he planned to construct the "Dew Terrace" Lutai 露臺 he refreigned from this plan when he heard how much money the counstruction would consume. For the same reason, the court robes of the ladies were tailored very short, and no expensive brocades were used for curtains in the palace. His own tomb mound was constructed only of bricks and adorned with an altar on the top. This policy of austerity helped the economy to recover, so that the reign of Emperor Wen and his son (Wen-Jing zhi zhi 文景之治) are remembered as a time of peace and gradual prosperity.
The guidelines for such an economic policy were developed by Chao Cuo 晁錯 and Jia Yi 賈誼, Emperor Wen's advisors for realpolitik. They urged him to confer upon sons of princes small marquisate territories in order to decrease their economical and military power. Jia Yi also recommended fortifying the northern border as an impediment to the growing amount of invasions by hordes of the steppe federation of the Xiongnu 匈奴.
Emperor Wen's posthumous honorific title is Emperor Xiaowen 漢孝文皇帝, his temple name is Taizong 漢太宗. He is buried in the tomb mound Baling 漢霸陵. Emperor Wen was succeeded by his son, Emperor Jing 漢景帝 (r. 157-141).