structural:reformatting, information:classification, stylistic:tone
Birth and early life

According to the Han imperial mythology, Liu Bang's ancestors were the mythical Emperor Yao and the Yellow Emperor. Many ancient Chinese noble families claimed descent from the Yellow Emperor to justify their right to rule.

Liu Bang was born during the late years of the Warring States period; his parents are only remembered as " Liu Taigong " and "Liu Ao" (劉媪; ' Old Madam Liu '). His family was from Zhongyang (中陽里) in the state of Chu. According to legend, Liu Bang was conceived after Liu Ao encountered a jiaolong dragon during a rainstorm.

According to records, the young Liu was outspoken, charismatic, generous, and forbearing, but he had little interest in education or work and frequently ran into trouble with the law; he was dependent on his brother for subsistence and his father called him "little rascal". Later, he became good friends with Zhang Er (張耳; d. 202 BC), the magistrate of the nearby Waihuang County and former retainer of Lord Xinling. Liu lived with Zhang Er for several months, until the latter went into hiding after the conquest of Chu by Qin.

Liu returned to Pei County. His close friends at the county office, Xiao He and Cao Shen, hid his delinquent behaviour and helped him to be appointed as the local sheriff (亭長) at Sishui Pavilion (泗水亭). Liu Bang forged close relationships with most of the local county bureaucrats, and earned a small reputation in the district. While performing corvée labour in the Qin capital at Xianyang, he witnessed Qin Shi Huang undertaking an inspection tour; the royal procession impressed Liu.

Liu's wife, Lü Zhi, was the daughter of Lü Wen (呂文), a wealthy and influential gentry from Shanfu County. After moving to Pei County, Lü Wen held a feast for the local elite. Xiao He, who helped to collect gifts from the guests, declared that a seat inside the hall required gifts worth at least a thousand coins. Liu attended the feast without money, and made an offer of ten thousand coins which Xiao He realized was not serious. Nonetheless, Lü had Liu seated beside him based on appearance alone. Lü, further impressed by Liu in conversation, offered his daughter in marriage. Liu and Lü Zhi were married and had two children, Liu Ying (the future Emperor Hui) and the future Princess Yuan of Lu.