thumb|right|An illustration of nine of the [[108 Heroes by Utagawa Kuniyoshi. Hou Jian is in the centre while the others (clockwise from the top) are Pei Xuan, An Daoquan, Jin Dajian, Li Yun, Tang Long, Cao Zheng, Huangfu Duan, and Xiao Rang.]]
Pei Xuan is a fictional character in Water Margin, one of the Four Great Classical Novels in Chinese literature. Nicknamed "Iron Faced Magistrate's Clerk", he ranks 47th among the 108 Heroes and 11th among the 72 Earthly Fiends.
Background
Originally from Jingzhao Prefecture (; around present-day Xi'an, Shaanxi), Pei Xuan started out as a kongmu (; magistrate's clerk) in his native prefecture. He is known for being uncompromising in upholding justice, incorruptible before bribes and fearless of coercions. These attributes earn him the nickname "Iron Faced Magistrate's Scribe". Besides being learned in the law of the ruling Song dynasty, Pei Xuan, who has a chubby face, is well-trained in swordmanship and scholarly arts.
Becoming an outlaw
Pei Xuan's approach in dealing with cases ultimately gets him into trouble with higher-ranking officials, who falsely accuse him of insubordination and get him sentenced to exile in Shamen Island (; present-day Changdao County, Shandong).
En route to Shamen Island, Pei Xuan and the guards escorting him pass by Yinma River (; in present-day Ji County, Tianjin), where they are intercepted by an outlaw band led by Deng Fei and Meng Kang. After the outlaws free him, they are so impressed with his aplomb and upright personality that they make him their new chief.
Joining Liangshan
Pei Xuan, along with Deng Fei and Meng Kang, makes his first appearance in the novel when they are introduced by Yang Lin, an old acquaintance of Deng Fei, to Dai Zong when he passes by Yinma River on his way to find Gongsun Sheng in Jizhou (; present-day Jizhou, Tianjin).
Dai Zong, who is already part of the outlaw band at Liangshan Marsh, invites Yang Lin and the outlaws at Yinma River to join Liangshan, and they accept.
Campaigns and later life
Pei Xuan is appointed as Liangshan's chief justice after the 108 Heroes are fully assembled, drawing on his knowledge of the law to adjudicate disputes in Liangshan and decide on rewards and punishments. He participates in the campaigns against the Liao invaders and rebel forces in Song territory after the outlaws receive amnesty from Emperor Huizong.
During the campaign against Wang Qing's rebel forces, Pei Xuan and two other Liangshan heroes (Xiao Rang and Jin Dajian) are captured by the enemy in Jingnan (; around present-day Jingzhou, Hubei). Despite being tortured, they refuse to surrender or divulge any information about the Liangshan forces. They are only saved after Wang Qing's subordinate starts a mutiny.
Pei Xuan is one of the few Liangshan heroes who survive all the campaigns. Although the emperor offers him an official appointment to honour him for his contributions during the campaigns, he declines and chooses to return to Yinma River with Yang Lin to lead a peaceful life.
