Xuan Ni (軒輗; died June 8, 1464) was a distinguished administrator of Ming dynasty China. Greatly admired for his character and anti-corruption efforts, he is "known as one of the few scholar-officials during this period extolled for their integrity and discipline."
Xuan's family, of unknown origin, settled in Luyi, Henan. Xuan passed the Henan provincial examination in 1420, and passed the jìnshì (the highest and most difficult imperial examination) in 1424.
Upon passing the jìnshì, Xuan Ni was immediately appointed as vice director of the messenger office. Seven years later, in March 1431, he was promoted to censor, with assignments in Fujian and Zhejiang. He was one of seventeen censors dispatched to check the military registry in October 1436. The group discovered abuses and numerous cases of desertion; Xuan Ni headed the effort to submit several recommendations to the emperor about reform. In May 1440, Xuan Ni received a promotion, becoming surveillance commissioner of Zhejiang. He remained in this role for nine years, during which time he earned fame for fighting official corruption. In 1444, Xuan spoke out against a proposal to reopen the royal silver mines in Zhejiang, noting their unpopularity amongst the people. However, owing to the influence of powerful eunuchs, the court ignored Xuan and reopened the mines anyway, leading to subsequent miner uprisings (led by the rebel Ye Zongliu). In July 1448, Xuan urged to the court to implement a policy punishing those who recommend corrupt officials. In 1449, Oirat Mongol tribes invaded, capturing Emperor Yingzong. His brother Qiyu took power, and Xuan Ni was promoted to deputy censor-in-chief and governor of Zhejiang. In February 1450 he was also assigned to administer the important salt industry in the province. In this role, Xuan suppressed several insurrections by bandits, most notably one in May 1450 in Chuzhou. For this, Xuan was rewarded with a raise. In May 1451, the court decided to transfer Xuan to Nanking, as director-general of grain storage for military supplies. They soon extended his authority to the Suzhou region when locals complained about abuses by soldiers. In March 1454, Xuan was promoted to head of the Censorate. A year later, after falling ill, he requested to retire but the emperor rejected it. In 1457 when Emperor Yingzong reclaimed the throne, Xuan received another promotion to be Minister of Justice. Noting the insidious, growing influence of eunuchs like and his underling on the court, Xuan was cautious of continuing as an official. He requested retirement, and the emperor granted it to him. A year later, he was called back to serve as director of grain storage again in Nanking. After some time, he fell ill and asked once again for retirement.
Xuan died in 1464, six months after he retired. In 1593, Xuan was canonized as Duan Su (端肅). Following this, a shrine was erected in his memory in Henan, and an essay was written praising him. Xuan Ni had a son, Xuan Weiming (軒惟明), who also became an official.