Emperor Xianzong of Tang (4 March to 1 April 778Old Book of Tang, vol. 14. – 14 February 820; r. 805 – 820), personal name Li Chun, né Li Chun (), was an emperor of the Chinese Tang dynasty. He was the eldest son of Emperor Shunzong, who reigned for less than a year in 805 and who yielded the throne to him late that year.

Once emperor, Emperor Xianzong set out to curb the power of the military governors (Jiedushi), and, when they would not heed his orders, he waged wars against them. His initial campaigns were quite successful, and Xianzong's army defeated warlords such as Liu Pi, Yang Huilin () in 806 and Li Qi in 807. In 813, after the submission of one of the key holdouts, Weibo Circuit (魏博, headquartered in modern Handan, Hebei) under Tian Xing, Emperor Xianzong appeared poised to reunite the empire, many parts of which had effectively been ruled independently by regional warlords. Xianzong's first setback was in 813 when he failed to defeat military governor Wang Chengzong. However, by 817, after the defeat of Li Shidao and Wang's submission, all of the empire was under imperial authority again. Later historians referred to Emperor Xianzong's reign as the Yuanhe Restoration ().E.g., Bo Yang Edition of the Zizhi Tongjian, vol. 57, preface.

Emperor Xianzong's reign briefly stabilized Tang from the destructive forces of the military governors, but saw the rise of the power of eunuchs. Emperor Xianzong himself was allegedly murdered by the eunuch Chen Hongzhi () in 820. (There were nagging suspicions, never proven, that Xianzong's wife Consort Guo and her son Li Heng (the later Emperor Muzong) were involved.)

Background Li Chun was born in 778, during the reign of his great-grandfather Emperor Daizong, at the Eastern Palace (i.e., the palace of his grandfather, then-Crown Prince Li Kuo). His father Li Song was Li Kuo's oldest son, and he himself was Li Song's oldest son. His mother was Li Song's concubine Consort Wang. When Li Chun was five or six, by which time Li Kuo was emperor (as Emperor Dezong), there was an occasion when Emperor Dezong held Li Chun on his lap and asked, "Who are you, such that you are in my lap?" His response of, "I am the third Son of Heaven" surprised Emperor Dezong, who thereafter showed him much favor.

As the Prince of Guangling and Crown Prince In 788, by which time Li Song (Shunzong) was crown prince, Li Chun was created the Prince of Guangling. In 793, he married Lady Guo, a daughter of the deceased general Guo Ai () and Emperor Daizong's daughter Princess Shengping, as his wife and princess.Zizhi Tongjian, vol. 234.Old Book of Tang, vol. 52.

In 804, Li Song (Shunzong) suffered a stroke and became unable to speak. When Emperor Dezong fell gravely ill in spring 805, Li Song was unable to visit him, and Emperor Dezong, distressed over this, died soon thereafter. After Emperor Dezong's death, the eunuchs in the palace initially considered supporting another person as emperor, but due to the objections of the imperial scholars Wei Cigong () and Zheng Yin, Li Song was able to assume the throne (as Emperor Shunzong), although during Wei and Zheng's discussion with the eunuchs, the possibility of having Li Chun take the throne directly was mentioned.

As Emperor Shunzong continued to be seriously ill and unable to speak, a group of his close associates—the eunuch Li Zhongyan (), his concubine Consort Niu, the imperial scholars Wang Shuwen and Wang Pi, and the chancellor Wei Zhiyi—became the key decision-makers. It was said that this group of individuals feared Li Chun for his intelligence and decisiveness, and initially, Li Chun was not created crown prince. However, the eunuchs Ju Wenzhen (), Liu Guangqi (), and Xue Yingzhen (), all of whom were favored by Emperor Dezong and who lost their power in the new regime, summoned the imperial scholars Zheng, Wei Cigong, Li Cheng, and Wang Ya to the palace to draft an edict for Emperor Shunzong creating Li Chun as crown prince, anyway. Zheng showed a piece of paper to Emperor Shunzong reading, "The Crown Prince should be the oldest son." Emperor Shunzong, who was unable to speak, nodded, and an edict was thereafter issued in late spring 805 creating Li Chun crown prince. The edict also changed Li Chun's name (from 淳 to 純—both rendered "Chun" in modern Mandarin). It was said that Wang Shunwen was so concerned about Li Chun that he was heard reading from Du Fu's poem about the Shu Han regent Zhuge Liang—"He had not even succeeded in his campaigns when he died. This often caused heroes to weep onto their collars." Wang Shuwen and Wei Zhiyi tried to see if their group could persuade Li Chun to favor their positions by having their associate Lu Zhi () serve as the attendant to Li Chun's studies. However, it appeared that Li Chun disliked Wang Shunwen and his associates, and whenever Lu tried to speak to him on political matters, Li Chun angrily responded, "His Imperial Majesty commissioned you, sir, to teach me about the classics. Why do you discuss other matters?"

By summer 805, a group of military governors (Jiedushi) that Wang Shuwen had disputes with—Wei Gao, Pei Jun (), and Yan Shou ()—were submitting petitions to Emperor Shunzong requesting that he let Li Chun serve as regent, and Wei Gao further submitted a petition to Li Chun as well requesting that he take power away from Wang Pi, Wang Shuwen, and Li Zhongyan. On August 26, an edict was issued in Emperor Shunzong's name for Li Chun to serve as regent. Thereafter, the imperial officials began to report to Li Chun. On August 31, Emperor Shunzong further issued an edict yielding the throne to Li Chun, taking for himself the title of "Retired Emperor" (Taishang Huang) and creating Li Chun's mother Consort Wang "Retired Empress." On September 5, Li Chun took the throne (as Emperor Xianzong).Volume 236 of the Zizhi Tongjian recorded that Xianzong assumed the throne on the yisi day of the 8th month of the 1st year of the Yongzhen era of Shunzong's reign. This corresponds to 5 Sep 805 in the Julian calendar. [(永贞元年八月)乙巳,宪宗即位于宣政殿。] Zizhi Tongjian, vol. 236

As Emperor

Early reign Immediately after Emperor Xianzong's ascension to the throne, he purged the government of Wang Shuwen and Wang Pi's associates, exiling them. (He would later order Wang Shuwen to commit suicide.) Emperor Xianzong's father Emperor Shunzong died in spring 806. Some later historians would come to believe that Emperor Shunzong did not die of natural causes, but was murdered by the same eunuchs who had supported Emperor Xianzong's ascension.(时以暴崩,皆言内官陈弘志弑逆,史氏讳而不书。) Old Book of Tang, vol. 15.(时人皆言内常侍陈弘志弑逆,其党类讳之,不敢讨贼,但云药发,外人莫能明也。) Zizhi Tongjian, vol. 241

Meanwhile, Wei Gao died late in 805, and his deputy Liu Pi seized power of Xichuan Circuit (西川, headquartered in modern Chengdu, Sichuan), which Wei had governed, rejecting the replacement that Emperor Xianzong sent, Yuan Zi. Emperor Xianzong, believing himself to lack the power to attack Liu at this point, initially made Liu the acting military governor. However, Liu then made further demands to be given two neighboring circuits—Dongchuan (東川, headquartered in modern Mianyang, Sichuan) and Shannan West (山南西道, headquartered in modern Hanzhong, Shaanxi)—as well. When Emperor Xianzong refused his demand, he launched an attack on Dongchuan's capital prefecture Zi Prefecture () in spring 806. At the suggestion of the chancellor Du Huangchang, Emperor Xianzong commissioned the general Gao Chongwen to attack Liu, assisted by the generals Li Yuanyi () and Yan Li (). In fall 806, Gao captured Xichuan's capital Chengdu and delivered Liu to the capital Chang'an to be executed.

Also in spring 806, Yang Huilin, the nephew of the general Han Quanyi () the military governor of Xiasui Circuit (夏綏, headquartered in modern Yan'an, Shaanxi), seized control of the circuit after Han had been ordered to retire and resisted imperial orders. With imperial forces approaching Xiasui's capital Xia Prefecture (), Yang was quickly killed by his own subordinate Zhang Chengjin (), ending his rebellion. Around the same time, the warlord Li Shigu, the military governor of the powerful Pinglu Circuit (平盧, headquartered in modern Tai'an, Shandong), died, and his subordinates supported his brother Li Shidao to succeed him. Du advocated trying to divest Pinglu of some of its territory, but Emperor Xianzong, believing that with the campaign against Liu not over by that point, that he should not wage another campaign, and therefore allowed Li Shidao to inherit Pinglu.

After Liu's and Yang's destruction, another warlord, Li Qi the military governor of Zhenhai Circuit (鎮海, headquartered in modern Zhenjiang, Jiangsu) became apprehensive, and, as a means of showing loyalty, requested to go to Chang'an to pay homage to Emperor Xianzong. He did not actually intend to do so, however, and after Emperor Xianzong not only approved, but issued an edict summoning him when he did not depart Zhenhai immediately, rebelled against the imperial government. Before imperial troops could attack him, however, he was captured by his own subordinates and delivered to Chang'an to be executed. Around that time, another warlord, Yu Di the military governor of Shannan East Circuit (山南東道, headquartered in modern Xiangfan, Hubei), fearing Emperor Xianzong, went to Chang'an and yielded control of the circuit to the imperial government, after Emperor Xianzong had ensured Yu's loyalty by marrying his daughter Princess Puning to Yu's son Yu Jiyou ().

In 808, an incident occurred that, as later historians opined, precipitated the later partisan struggles between the "Niu Party" and the "Li Party" that would eventually occur throughout the reigns of the five emperors after Emperor Xianzong.E.g., Bo Yang, Outlines of the History of the Chinese (中國人史綱), vol. 2, pp. 568–571. At a special imperial examinations where Emperor Xianzong ordered that low-level officials submit honest opinions about the government, several of the examinees—Niu Sengru, Li Zongmin, and Huangfu Shi () stated, without using any veiled language, the issues they saw with the governance at the time. The officials that Emperor Xianzong put in charge of the examinations, Yang Yuling () and Wei Guanzhi ranked them high. However, the chancellor Li Jifu saw these as severe criticisms of himself, and, weeping, accused the reviewing officials, the imperial scholars Pei Ji and Wang Ya, of conflict of interest—as Huangfu was a nephew of Wang's. As a result of Li Jifu's accusations, Wang, Pei, Yang, and Wei were all demoted, and it was said that while no harm came to Niu, Li Zongmin, and Huangfu at that time, they were effectively stuck at the positions they previously served without promotion. As a result, they all sought positions as staff members of military governors. (Niu and Li Zongmin would later become key leaders of the "Niu Party," while Li Jifu's son Li Deyu would become a key leader of the "Li Party.")

Also around that time, the Shatuo tribes, which had long been vassals of Tang's long-term adversary Tufan, fearing that Tufan was set to move them to the interior of the Tufan state, rebelled against Tufan and surrendered to Tang, under the leadership of Zhuxie Zhiyi (). They were initially settled at Shuofang Circuit (朔方, headquartered in modern Yinchuan, Ningxia) and later moved to Hedong Circuit (河東, headquartered in modern Taiyuan, Shanxi); their chieftains of the Zhuxie clan were given the area of Huanghuadui (黃花堆, in modern Shuozhou, Shanxi) as their base of operations. (The Shatuo would eventually become a major part of the Tang army, and would yet later yield the ruling families of Later Tang, Later Jin, and Later Han, after Tang's end.)Bo, Outlines of the History of the Chinese, vol. 2, p. 574.Bo, Outlines of the History of the Chinese, vol. 2, pp. 592–603.