Han Yanhui was born in 882, during the reign of Emperor Xizong of Tang. His family was from Anci — but it was not clear whether he was born there, as his father Han Mengyin served successively as the prefect of three prefectures — Ji, Ru, and Shun, all of which belonged to Lulong Circuit — so he might have been born at Anci, one of the three prefectures, or Lulong's capital You Prefecture. In his youth, he impressed Lulong's then military governorLiu Rengong, and Liu made him the education officer for the circuit and investigatory officer at Ping Prefecture, but apparently he remained at headquarters, serving with the later prominent Five Dynasties chancellor Feng Dao. Eventually, he was promoted to be assistant to Liu in Liu's office as the governor of You. In 907, Liu Rengong's son Liu Shouguang overthrew him and took over Lulong. When the Tang throne was shortly after seized by the major warlord Zhu Quanzhongthe military governor of Xuanwu Circuit, ending Tang and starting a new state of Later Liang, Liu Shouguang initially became a vassal of Later Liang's, but in 911 claimed the title of emperor of a new state of Yan. This soon brought an attack by Jin's prince Li Cunxu, allied with Wang Rong the Prince of Zhao and Wang Chuzhi the military governor of Yiwu Circuit. Under siege from them, Liu Shouguang sent Han Yanhui to the court of the Khitan Empire to seek aid. Khitan's Emperor Taizu was offended by Han's refusal to bow to him, and therefore detained him and made him tend horses. Emperor Taizu's wife Empress Shulü Ping stated to the emperor, "Han Yanhui kept his faith and not give in. This shows that he is a good man. Why do you humiliate him by making him tend horses? You should respect him and use him." Emperor Taizu thereafter recalled Han to his court and, after speaking with him and being impressed by his talent, kept him as a chief strategist.
Service under Emperor Taizu
It was said that, as Emperor Taizu's chief strategist, Han Yanhui helped the Khitan Empire's subjugation of the Dangxiang and the Shiwei tribes. He also taught the Khitan how to build headquarters, city walls, and markets, to make it attractive for the ethnic Han to remain in the Khitan realm. He also arranged marriages for the ethnic Han and gave them fallow fields to till and grow plants, such that the ethnic Han taken by the Khitan were no longer always looking to escape the Khitan realm. It was said that because of this, the Khitan Empire grew more and more powerful. In or sometime before 916, Han Yanhui himself escaped from the Khitan court and fled to Jin's capital Jinyang. Li Cunxu wanted to put Han on his staff, but his secretary generalWang Jian disliked Han. Han did not feel secure, and therefore ask to head back east to Lulong to see his mother. When he stopped in Zhao, he stayed with his friend Wang Deming. When Wang Deming asked him what his plans were, he responded, "All territory north of the Yellow River are now Jin's. I will return to the Khitan." When Wang questioned him that given that he had escaped, return would mean death, he responded, "My flight was to them like losing hands and eyes. When I return, they would be regaining hands and eyes. They would surely not harm me." He went to see his mother, and then returned to the Khitan court. Emperor Taizu was pleased at seeing his return, and patted his back, stating, "Why did you leave?" He responded, "I missed my mother and wanted to return, but I was afraid that you would not allow me, and that was why I left without permission." Emperor Taizong treated him even better after that. Emperor Taizong also gave a Khitan name, "Xialie," meaning "one who returned." He soon gave Han the chancellor title of Zhengshi Ling and grand imperial scholar at Chongwen Pavilion. Han was much involved in the policy decisions both in domestic and foreign matters. In 925, Han followed Emperor Taizong in his campaign against Balhae, whose king Dae Inseon submitted to Khitan and then again rose against Khitan. For Han's contributions on the campaign, he was given the title of Zuo Pushe. He then captured Balhae's Changling Municipality with the general Kang Moji.
Service under Emperor Taizong
In 926, Emperor Taizu died and was succeeded by his son Emperor Taizong. Han Yanhui continued to serve as Zhengshi Ling, and was created the Duke of Lu. At some point, he was sent on a diplomatic mission to then-vassal state of Liao, Later Jin. Upon the return from the mission, he was apparently relieved of his duties as chancellor and made the director of the three financial agencies at the southern capital.
Service under Emperor Shizong
In 947, Emperor Taizong died and was succeeded by his nephew Emperor Shizong. Sometime during Emperor Shizong's reign, Han Yanhui was made the chancellor of Liao's "southern government". When Emperor Shizong established the southern government's office of the chancellors in 950, Han was the one who was said to be most involved in establishing its structure and staffing it with administrators. In 951, when Liao's vassal Northern Han's emperor Liu Chong requested that Emperor Shizong formally create him emperor of Northern Han, Emperor Shizong had Han organize the ceremony, and Han largely followed the ceremony that Emperor Taizong used when creating Shi Jingtang the emperor of Later Jin.
Service under Emperor Muzong
Emperor Shizong was assassinated in 951, and was succeeded by his cousin Emperor Muzong. During Emperor Muzong's reign, Han Yanhui retired. At that time, his son Han Deshu was the defender of Dongping, and Emperor Muzong issued an edict allowing Han Deshu to return to visit him once each year. Han Yanhui died in 959 and was given posthumous honors. He was buried at You Prefecture.