|Emperor Yuan of Wei|
|Emperor of Cao Wei|
|Reign||27 June 260 – 4 February 266|
|Duke of Changdao District, Anci County|
|Tenure||256 – 27 June 260|
|Prince of Chenliu (陳留王)|
|Tenure||4 February 266 – 302|
|House||House of Cao|
|Father||Cao Yu, Duke of Yan|
Cao Huan (pronunciation (help·info)) (246–302), courtesy name Jingming, was the fifth and last emperor of the state of Cao Wei during the Three Kingdoms period. On 4 February 266, he abdicated the throne in favour of Sima Yan (later Emperor Wu of the Jin dynasty), and brought an end to the Wei regime. After his abdication, Cao Huan was granted the title "Prince of Chenliu" and held it until his death, after which he was posthumously honoured as "Emperor Yuan (of Cao Wei)".
Cao Huan's birth name was "Cao Huang" (曹璜). His father, Cao Yu, the Prince of Yan, was a son of Cao Cao, the father of Wei's first emperor, Cao Pi. In 258, at the age of 12, in accordance with Wei's regulations that the sons of princes (other than the first-born son of the prince's spouse, customarily designated the prince's heir) were to be instated as dukes, Cao Huan was instated as the "Duke of Changdao District" (常道鄉公).
In 260, after the ruling emperor Cao Mao was killed in an attempt to seize back state power from the regent Sima Zhao, Cao Huang was selected to succeed Cao Mao.
At the time Cao Huang became emperor, his name was changed to "Cao Huan" because it was difficult to observe naming taboo with the name "Huang" (which was a homonym to many common terms—including "yellow" 黃 and "emperor" 皇). During Cao Huan's reign, the Sima clan controlled state power and Cao was merely a figurehead and head of state in name. In 263, Cao Huan instated his wife Lady Bian as empress.
For the first few years of Cao Huan's reign, there were constant attacks by forces from the rival Shu Han state under the command of Jiang Wei. While Jiang Wei's attacks were largely easily repelled, Sima Zhao eventually ordered a counterattack on Shu with an invading force of 180,000 men commanded by Zhong Hui and Deng Ai. In late 263, Liu Shan, the Shu emperor, surrendered to Deng, bringing an end to the state of Shu. After the fall of Shu, Deng Ai was framed for treason by Zhong Hui and stripped of command. In early 264, Zhong Hui plotted with Jiang Wei to restore Shu and eliminate all the Wei generals who might oppose him. However, the generals started a counterinsurgency and killed Zhong Hui and Jiang Wei. Shu's former territories (in present-day Sichuan, Chongqing, Yunnan, southern Shaanxi, and southeastern Gansu) were completely annexed by Wei.
Wei itself did not last much longer after Shu's collapse. In 263, Sima Zhao again forced Cao Huan to grant him the nine bestowments and this time he finally accepted signifying that a usurpation was near. In 264, Sima Zhao became a vassal king under the title "King of Jin" — the final step before usurpation. After Sima Zhao died in September 265, his son, Sima Yan, inherited his father's position and on 4 February 266 forced Cao Huan to abdicate, thereby establishing the Jin dynasty. He granted Cao Huan the title "Prince of Chenliu" which Cao Huan carried until his death.
Not much is known about Cao Huan's life as a prince under Jin rule. Sima Yan (later known as Emperor Wu of Jin) permitted him to retain imperial banners and wagons and to worship ancestors with imperial ceremonies. He also permitted Cao Huan not to refer to himself as a subject of his. He died in 302 during the reign of Emperor Wu's son, Emperor Hui. He was buried with honours due an emperor and given a posthumous name.
It is not known who immediately succeeded Cao Huan as Prince of Chenliu, but in late 326, the position of Prince of Chenliu was conferred upon Cao Mai, the great-great grandson of Cao Cao, who held the title until his death in 358. He was succeeded by his son, Cao Hui, whose title was confirmed on 24 November 363.