Li Mi (; 582 – 20 January 619geng'zi day of the 12th month of the 1st year of the Wu'de era, per Tang Gaozu's biography in Old Book of Tang), courtesy name Xuansui (), pseudonym Liu Zhiyuan (), was a Chinese military general, monarch, poet, politician, and rebel. He was the leader of a rebel movement against the rule of the Chinese Sui dynasty. He initially was the strategist of the Sui general Yang Xuangan, who rebelled against Emperor Yang of Sui in 613 but failed. In 617, Li subsequently led a rebellion against Emperor Yang in his own right and killed Zhai Rang, seizing Zhai's troops.

There was expectation that Li Mi would prevail over Sui forces and establish a new dynasty—so much so that even other key rebel leaders, including Dou Jiande, Meng Haigong (), Xu Yuanlang, and Zhu Can, were urging him to take imperial title. Even Li Yuan (soon to become the founder of the Tang dynasty as Emperor Gaozu) was writing him in supplicating terms that implicitly supported his imperial claim.

Li Mi tried to gain control of the Sui eastern capital Luoyang, but his forces became stalemated by the Sui forces there, and he never came around to claiming the imperial title, instead accepting the title of Duke of Wei.

In October 618, the Sui general Wang Shichong crushed his forces at Yanshi. Li Mi fled to Tang territory and submitted to Emperor Gaozu, but subsequently rebelled against Tang and tried to revive his own army. The Tang general Sheng Yanshi () captured and executed Li Mi.

Background Li Mi came from a line that was part of the nobility during successive dynasties Western Wei, Northern Zhou, and Sui dynasty. His great-grandfather Li Bi was one of Eight Zhuguo (八柱国) of Western Wei. By the time of his father Li Kuan (), who carried the Sui-created title of Duke of Pushan, the clan, although not originally from there, lived at the Sui capital Chang'an. Due to his father's position, Li Mi became a guard of Emperor Yang of Sui, and he was said to view money lightly, using it to instead gather friends around him. One day, however, when Emperor Yang saw him, Emperor Yang was apprehensive of his appearance, and told his associate Yuwen Shu the Duke of Xu to have Li Mi removed. Thereafter, Yuwen persuaded Li Mi to resign from the imperial guard corps, and Li instead often traveled around the capital, riding a bull and reading while doing so—particularly the Book of Han. When the prime minister Yang Su the Duke of Yue saw him, Li knew it was the prime minister and he bowed and stated his name. Yang Su took Li to his mansion and talked with him. Yang then told his son Yang Xuangan, "Li Mi's intelligence and capability is far beyond yours."As Emperor Yang became emperor in 604 and Yang Su died in 606, the incident must have occurred between those two events. Sometimes, Yang Xuangan would bully Li, and Li responded:

Participation in Yang Xuangan's rebellion

In 613, with Emperor Yang at the frontlines attacking Goguryeo, Yang Xuangan, who had been apprehensive since he heard rumors that Emperor Yang had remarked, "If Yang Su did not die, his clan would have eventually been exterminated," considered rebelling. Emperor Yang had put him in charge of keeping the supply lines clear near the eastern capital Luoyang, and Yang Xuangan took the opportunity to seize the gathered food supply and then declare a general rebellion against Emperor Yang. At the same time, he secretly sent his servants to Chang'an to summon Li and his brother Yang Xuanting (). Once Li arrived, Yang Xuangan made Li his chief strategist, and Li gave him three options, in the order of Li's opinion as to their feasibility:

Li's "high strategy" involved making a surprise attack on Jicheng (, in modern Beijing) and Linyu (, in modern Qinhuangdao, Hebei), capturing those key locations to trap Emperor Yang, who then was on the Goguryeo front. Li believed that Goguryeo would then make a crippling attack on Emperor Yang, and that Emperor Yang's forces would either collapse on their own or surrender. Li's "middle strategy" involved making a surprise attack on Chang'an and capturing the surrounding Guanzhong region, and then holding the region and preparing for confrontation with Emperor Yang. Li's "low strategy" involved making a surprise attack on the eastern capital Luoyang and trying to capture it quickly and hold it as the command center. However, he warned that Tang Hui (), who had initially submitted to Yang Xuangan but who had since fled back to Luoyang, might have already warned the city to firm up its defenses—and that if Yang Xuangan put Luoyang under siege and could not capture it quickly, he would soon be trapped by converging Sui forces.

Yang Xuangan, however, believing that he needed to capture Luoyang to show that his rebellion was serious, commented that Li's "low strategy" was in fact "high strategy," and headed toward Luoyang. However, as Li had predicted, Tang had warned Emperor Yang's grandson Yang Tong the Prince of Yue and the official Fan Zigai (), whom Emperor Yang left in charge of Luoyang, and Luoyang's defenses had been prepared. While Yang Xuangan and his brothers gained some victories, he could not quickly capture Luoyang. Meanwhile, many young noblemen were joining his cause. After he captured the highly regarded official Wei Fusi (), he trusted Wei as well and did not only trust Li any further, but strategies that Wei submitted were not wholeheartedly in support of the rebellion. Li requested that Yang Xuangan kill Wei, but Yang Xuangan refused. Li made the comment to his relatives, "The Duke of Chu wanted to rebel, but does not know how to gain final victory. We are now like turtles stuck in urns." When Li Zixiong () suggested that Yang Xuangan take imperial title, however, Li advised him that the act was inadvisable, and Yang agreed and did not do so.

Soon, Wei Wensheng (), the official Emperor Yang left in charge of Chang'an, came to Luoyang's aid with his troops, and Lai Hu'er (), a general that Emperor Yang had also put in charge of keeping the supply line clear, also arrived. Further, the forward forces returning from the Goguryeo front, under the command of Qutu Tong () and Yuwen Shu, soon arrived as well, and while Yang Xuangan attempted to prevent them from crossing the Yellow River, attacks from Fan prevented Yang Xuangan from being able to cut Qutu and Yuwen off at the Yellow River, allowing them to cross. Yang Xuangan was soon losing battles, and under the suggestion of Li Zixiong and Li Mi, he decided to falsely declare that Yuan Hongsi (), the general in command at Honghua (, in modern Qingyang, Gansu), was joining his cause, and that he was going to meet with Yuan.

In fall 613, Yang Xuangan thus lifted the siege on Luoyang, and headed west. On the way, however, he was tempted by the people of Hongnong (, in modern Sanmenxia, Henan), who opined that Hongnong would be easily captured and could be held. Further, the governor of Hongnong Commandery, Emperor Yang's cousin Yang Zhiji () the Prince of Cai, was intentionally insulting Yang Xuangan to enrage him. In anger, Yang Xuangan put Hongnong under siege, despite Li Mi's pleas that he was endangering his campaign by proceeding slowly. Yang Xuangan put Hongnong under siege for three days but could not capture it, and therefore had to continue to head west. By this point, the Sui forces commanded by Yuwen, Wei, Lai, and Qutu had caught up to him, and were dealing him defeats, and his forces collapsed. Yang Xuangan and his brother Yang Jishan fled to Jialurong (, also in modern Sanmenxia) on foot, and Yang Xuangan, realizing that they were about to be captured and not wanting to be captured, asked Yang Jishan to kill him. Yang Jishan did so, and then tried to commit suicide, but before he could die, he was captured.

After Yang Xuangan's death Li Mi was also captured, and he, Wei Fusi, Yang Jishan, and Wang Zhongbo () were taken by Fan Zigai, to be delivered to Emperor Yang, who was returning from the Goguryeo front as well. On the way, Li and Wang discussed escaping. They showed their jailers their gold, and told them, "When we die, please spend the proceeds to bury us; the rest of it, we leave it as a gift." The jailers began to be careless around Li and Wang, and they often feasted together. When they reached Wei Commandery (), they got the jailers drunk, and then Li, Wang, and five others dug a hole on the wall and escaped. As they fled, Li suggested to Wei that he flee with them—but Wei refused, believing that Emperor Yang would pardon him—a fateful decision, for Emperor Yang executed both him and Yang Jishan cruelly.

For the next few years, Li travelled around, trying to find an agrarian rebel leader who would listen to his grand strategies, but his attempt to persuade Hao Xiaode () and Wang Bo () fell on deaf ears. Li was poor and often went hungry. At one point, he took the pseudonym Liu Zhiyuan and began teaching students in farming communities in Huaiyang Commandery (, roughly modern Zhoukou, Henan) how to read and write. During this period, he was so depressed that he wrote a poem about his ordeals, reading:

When Li finished the poem, he broke down in tears. People saw his behavior and reported to the commandery governor Zhao Tuo (), who sent soldiers to arrest him, but he was able to escape. He then went to his brother-in-law, Qiu Junming (), who was then the county magistrate for Yongqiu (, in modern Kaifeng, Henan). Qiu did not dare to keep him, but referred him to Wang Xiucai (), who was known for his bravery. Wang took Li in and gave his daughter to Li in marriage. Later, however, Qiu Junming's relative Qiu Huaiyi () informed on them, and by Emperor Yang's orders, the general Yang Wang () led soldiers to surround Wang Xiucai's house. Li happened to be away at the time and so escaped, but both Qiu Junming and Wang Xiucai were executed.

Li again tried to visit the rebel leaders to try to persuade them to follow his strategies. Most of the leaders considered Li's strategies overly grandiose, and they initially did not respect him. However, as time went by, some of them began to respect Li, particularly when they heard prophecies that the next emperor would be named Li, some speculated that Li, who was of noble birth and who had many times escaped death, would be the one. He became particularly close to the rebel leader Wang Bodang ().

Assassinating Zhai Rang By 616, Li Mi saw that Zhai Rang was the strongest rebel leader of the region, met Zhai through Wang Bodang. Li proposed some strategies for Zhai and was able to persuade some other rebel leaders to follow Zhai. Li therefore suggested to Zhai that, with Emperor Yang away at Jiangdu (, in modern Yangzhou, Jiangsu), he should gather his troops and attack Sui's two capitals: Luoyang and Chang'an. Zhai, not having the stomach yet of that grandiose design, did not accept the idea, but became more impressed with Li and kept Li as an honored guest.