Cao Pi (pronunciation ) (c. 187 – 29 June 226), courtesy name Zihuan, was the first emperor of the state of Cao Wei in the Three Kingdoms period of China. He was the second son of Cao Cao, a warlord who lived in the late Eastern Han dynasty, but the eldest son among all the children born to Cao Cao by his concubine (later wife), Lady Bian. According to some historical records, he was often in the presence of court officials in order to gain their support. He was mostly in charge of defence at the start of his career. After the defeat of Cao Cao's rival Yuan Shao at the Battle of Guandu, he took Yuan Xi's widow, Lady Zhen, as a concubine, but in 221 Lady Zhen died and Guo Nüwang became empress.
On 25 November 220, Cao Pi forced Emperor Xian, the last ruler of the Eastern Han dynasty, to abdicate in his favour, after which on 11 December 220 he proclaimed himself emperor and established the state of Cao Wei. Cao Pi continued the wars against the states of Shu Han and Eastern Wu, founded by his father's rivals Liu Bei and Sun Quan respectively, but did not make significant territorial gain in the battles. Unlike his father, Cao Pi concentrated most of his efforts on internal administration rather than on waging wars against his rivals. During his reign, he formally established Chen Qun's nine-rank system as the base for civil service nomination, which drew many talents into his government. On the other hand, he drastically reduced the power of princes, stripping off their power to oppose him, but at the same time, rendering them unable to assist the emperor if a crisis arose within the state. After Cao Pi's death, his successor Cao Rui granted him the posthumous name "Emperor Wen" and the temple name "Shizu".
Cao Pi was also an accomplished poet and scholar, just like his father Cao Cao and his younger brother Cao Zhi. He wrote Yan Ge Xing (燕歌行), the first Chinese poem in the style of seven syllables per line (七言詩). He also wrote over a hundred articles on various subjects.