Cui Yin was born in 854, during the reign of Emperor Xuānzong. He was from the prominent Cui clan of Qinghe (清河, in modern Xingtai, Hebei), which claimed ancestry from the ruling house of the Spring and Autumn period state Qi, and which traced its ancestry to officials of Qin Dynasty, Han Dynasty, Cao Wei, Jin Dynasty (265-420), Later Zhao, Southern Yan, Liu Song, Northern Wei, Northern Qi, and Tang Dynasty. Cui Yin's father Cui Shenyou was a chancellor during Emperor Xuānzong's reign. Cui Yin had at least one older brother, Cui Changxia (崔昌遐). (According to the biography of the powerful eunuch Qiu Shiliang in the New Book of Tang, Cui Yin developed a hatred for eunuchs early in his life due to Cui Shenyou's relating to him of an incident during the earlier reign of Emperor Xuānzong's nephew Emperor Wenzong, when Qiu tried to have Emperor Wenzong deposed.)
After Cui Yin passed the imperial examinations in the Jinshi (進士) class, he served on the staff of Wang Chongrong the military governor of Hezhong Circuit (河中, headquartered in modern Yuncheng, Shanxi). (Wang was military governor of Hezhong from 881 to Wang's death in 887, placing a timeframe on Cui's service under him.) Later, after Cui was recalled to the imperial government, he served successively as Kaogong Yuanwailang (考功員外郎) and then Libu Yuanwailang (吏部員外郎), both low-level positions at the ministry of civil service affairs (吏部, Libu). He was later promoted to a supervisory position at the ministry of civil service affairs (郎中, Langzhong). He was later made imperial attendant (給事中, Jishizhong) and then Zhongshu Sheren (中書舍人), a mid-level official at the legislative bureau of government (中書省, Zhongshu Sheng). During the Dashun era of Emperor Xuānzong's grandson Emperor Zhaozong (890-891), Cui successively served as deputy minister of defense (兵部侍郎, Bingbu Shilang) then deputy minister of civil service affairs (吏部侍郎, Libu Shilang). (It was said that his repeated promotions were a result of his close association with the chancellor Cui Zhaowei, who, while not a close relative, regarded him as a clansman.)
Thanks to his association with Cui Zhaowei, Cui Yin was promoted to be chancellor in 893 with the designation Tong Zhongshu Menxia Pingzhangshi (同中書門下平章事). As chancellor, he was described to be treacherous in his heart but appearing to be forgiving in his outward appearance. (It was also said that his uncle, the major general Cui Anqian, commented, "My father and brother had carefully built this household, but Zilang [(i.e., Cui Yin)] will destroy it!" although it was unclear whether Cui Anqian was still alive at this point.)
In 895, when Wang Chongrong's brother and successor Wang Chongying died at Hezhong (which had been renamed Huguo at this point), the soldiers supported Wang Chongrong's adoptive son and biological nephew Wang Ke to succeed him as the military governor, but Wang Chongying's son Wang Gong, then the military governor of neighboring Baoyi Circuit (保義, headquartered in modern Sanmenxia, Henan), also had designs on Huguo. Wang Ke was supported by his father-in-law Li Keyong the military governor of Hedong Circuit (河東, headquartered in modern Taiyuan, Shanxi), while Wang Gong was supported by his allies Li Maozhen the military governor of Fengxiang Circuit (鳳翔, headquartered in modern Baoji, Shaanxi), Wang Xingyu the military governor of Jingnan Circuit (靜難, headquartered in modern Xianyang, Shaanxi), and Han Jian the military governor of Zhenguo Circuit (鎮國, headquartered in modern Weinan, Shaanxi), and all these military governors submitted competing petitions to Emperor Zhaozong in support of Wang Ke or Wang Gong. Emperor Zhaozong initially approved Li Keyong's request and made Wang Ke the military governor of Huguo but, subsequently, trying to settle the dispute, named Cui the military governor of Huguo, still carrying the Tong Zhongshu Menxia Pingzhangshi designation as an honorary title. Wang Tuan was made a chancellor to replace him.
This failed to settle the dispute, however, and, at Cui Zhaowei's instigation (as Cui Zhaowei was allied with Li Maozhen and Wang Xingyu), the three military governors who supported Wang Gong marched on the imperial capital Chang'an, killing the chancellors Li Xi and Wei Zhaodu and forcing Emperor Zhaozong to accede to their demands. That, in turn, caused Li Keyong to launch his troops to attack them. Emperor Zhaozong, fearing that Li Maozhen and/or Wang Xingyu would seize him, fled into the Qinling Mountains. Cui Yin, along with chancellors Xu Yanruo and Wang Tuan, followed the emperor in flight. After Li Keyong defeated Wang Xingyu, who was then killed by his own subordinates, Li Maozhen and Han outwardly submitted to the emperor, and Emperor Zhaozong, after returning to Chang'an, ordered Li Keyong to end his campaign. Meanwhile, Cui was again made a chancellor, and also took the position of Zhongshu Shilang (中書侍郎), the deputy head of the legislative bureau. However, his ally, Cui Zhaowei, was exiled and then executed.
In 896, the fragile peace between the imperial government and Li Maozhen ended, and Li Maozhen again postured to attack Chang'an. Emperor Zhaozong and the imperial court initially decided to flee to Hedong, but due to the long distance involved and the urging of Han's, decided to head for Han's capital Hua Prefecture (華州) instead. Once the imperial court settled in at Hua Prefecture, however, Han inserted himself in all kinds of decision-making, and as one of his suggestions, Emperor Zhaozong, who was aware of the alliance between Cui Zhaowei and Cui Yin, decided to send Cui Yin away to serve as the military governor of Wu'an Circuit (武安, headquartered in modern Changsha, Hunan), still carrying the Tong Zhongshu Menxia Pingzhangshi designation as an honorary title; Cui was replaced with Lu Yi. Cui, however, secretly sought aid from Zhu Quanzhong the military governor of Xuanwu Circuit (宣武, headquartered in modern Kaifeng, Henan) — and suggested to Zhu that he could posture by preparing the palace at the eastern capital Luoyang and petitioning Emperor Zhaozong to move the capital to Luoyang. Zhu did so (along with his ally Zhang Quanyi the mayor of Henan Municipality (河南, i.e., the Luoyang region)) and also mobilized his troops; his petition also indicated his belief that Cui, as a faithful servant to the emperor, should not be sent away. Han, in fear of a potential Zhu attack, backed off, and Emperor Zhaozong subsequently kept Cui at court and made him a chancellor again, along with Cui Yuan. Cui Yin, displeased that Lu had replaced him, then falsely accused Lu of being an ally of Li Maozhen's; Lu was then exiled to the post of prefect of Xia Prefecture (硤州, in modern Yichang, Hubei).
Cui continued to serve as chancellor until 899, by which time Emperor Zhaozong had returned to Chang'an; Cui assumed just his regular posts of Zhongshu Shilang and minister of civil service affairs (吏部尚書, Libu Shangshu); Lu, who had been recalled by this point and was serving as the minister of defense (兵部尚書, Bingbu Shangshu), replaced him. (During this 896-899 term as chancellor, it was said that Cui secretly plotted with the emperor to slaughter the eunuchs. Wang Tuan, fearing the repercussions of such a plot, urged moderation, pointing out that a major confrontation between imperial officials and eunuchs would have uncertain results. When Cui was removed from the chancellor position in 899, he thus suspected Wang of being behind his removal and hated Wang from this point on; he also accused Wang of being in league with the powerful eunuch directors of palace communications Zhu Daobi (朱道弼) and Jing Wuxiu (景務脩).)
In 900, Cui Yin was sent out of the capital to serve as military governor of Qinghai Circuit (清海, headquartered in modern Guangzhou, Guangdong), carrying the Tong Zhongshu Menxia Pingzhangshi as an honorary designation. Cui, believing that Wang Tuan was trying to eliminate him as a rival, wrote Zhu Quanzhong to ask for aid. Zhu Quanzhong, in response, submitted multiple petitions accusing Wang of collaboration with Zhu Daobi and Jing Wuxiu and urging Emperor Zhaozong to keep Cui as a chancellor. As a result, Cui was recalled from his journey to Qinghai. Upon arrival in Chang'an, he was made chancellor again, as well as Sikong (司空, one of the Three Excellencies) and Menxia Shilang (門下侍郎), the deputy head of the examination bureau (門下省, Menxia Sheng). Wang was initially demoted to be the deputy minister of public works, while Zhu Daobi and Jing were sent out of the capital to serve as eunuch monitors; soon, all three were ordered to commit suicide. After this incident, Cui became, effectively, the most powerful official at court, and the eunuchs hated him. It was said that, because he was jealous of the more senior Xu Yanruo, that Xu decided to ask for the Qinghai assignment himself and was soon made the military governor of Qinghai.
The most powerful eunuchs — the commanders of the Shence Armies Liu Jishu and Wang Zhongxian (王仲先) and the new directors of palace communications Wang Yanfan (王彥範) and Xue Qiwo (薛齊偓) — fearing the next steps that Cui and Emperor Zhaozong — whose behavior had become increasingly erratic after his return from Zhenguo, apparently fueled by alcoholism — might take, began to plan a coup to overthrow the emperor and replace him with his son and crown prince Li Yi. In winter 900, after an incident where Emperor Zhaozong killed a few eunuchs and ladies in waiting in a drunken rage, the eunuchs acted. They mobilized the Shence Armies and forced the imperial officials, including Cui (who did not dare to oppose them given their military strength) to sign a petition urging Emperor Zhaozong to yield imperial power to Li Yu. Armed with the petition, the eunuchs then removed the emperor and put him under house arrest, declaring Li Yu emperor instead. Liu killed a number of officials, eunuchs, ladies in waiting, and other people that Emperor Zhaozong favored, but hesitated at killing Cui, fearing that Cui's ally Zhu Quanzhong, whose support for the coup he was trying to court, would react violently. Rather, they only removed Cui from one of his secondary offices, the directorate of salt and iron monopolies.
Cui, meanwhile, had been writing Zhu urging him to mobilize his forces to return Emperor Zhaozong to the throne; Zhu's staff member Li Zhen urged the same. Zhu thus put Liu's emissaries to him — Liu's adoptive son Liu Xidu (劉希度) and another eunuch, Li Fengben (李奉本) — under arrest, and sent Li Zhen to Chang'an to personally confer with Cui on what to do next. Cui also sent his secretary Shi Jian (石戩) to persuade the Shence Army officer Sun Dezhao (孫德昭) to plan a countercoup. Sun subsequently persuaded his fellow officers Dong Yanbi (董彥弼) and Zhou Chenghui (周承誨) to join the countercoup as well. In spring 901, they killed Liu Jishu, Wang Zhongxian and Wang Yanfan; Xue committed suicide. They then restored Emperor Zhaozong. It was said that after this series of events Emperor Zhaozong trusted Cui even more.
In the aftermaths of Emperor Zhaozong's restoration, Cui urged that he end the eunuch control on the Shence Armies by putting Cui and Lu Yi in command of the Shence Armies, which Cui and Lu reasoned would allow not only the end of eunuch power, but also serve as a counterweight against the warlords. However, this was opposed both by Li Maozhen (who was at Chang'an at that time to pay homage to Emperor Zhaozong) and the three Shence Army officers who restored Emperor Zhaozong to the throne (on whom Emperor Zhaozong had bestowed the imperial clan name of Li, with Sun and Zhou also receiving the new names of Jizhao (繼昭) and Jihui (繼誨), respectively). Emperor Zhaozong thus instead put the eunuchs Han Quanhui and Zhang Yanhong (張彥弘) in command of the Shence Armies. Cui, fearing the return of the Shence Armies to the eunuchs' command, secretly asked Li Maozhen to leave a contingent of 3,000 Fengxiang soldiers at Chang'an, commanded by Li Maozhen's adoptive son Li Jiyun (李繼筠), to serve as a counterbalance — notwithstanding the argument by the imperial scholar Han Wo that the Fengxiang contingent would merely complicate the problem. Around the same time, at Cui's recommendation, his former staff member Wang Pu was made a chancellor as well, along with Pei Shu.
Cui thereafter also tried to reduce the money supply of the Shence Armies by ending the yeast monopolies that the armies, including the Shence Armies, held. Li Maozhen, whose Fengxiang army would also be impacted, opposed, and went to Chang'an personally to argue his case to the emperor. When he was at Chang'an, Han took the opportunity to enter into an alliance with him. Cui realized this, and thereafter strengthened his own relationship with Zhu, in opposition to LI Maozhen.
By summer 901, Cui and Emperor Zhaozong were again discussing slaughtering the eunuchs. They were communicating by secret sealed notes to each other, but the eunuchs placed several ladies in waiting who were capable of reading in the palace to spy on the emperor, and the ladies in waiting thereafter reported to the eunuchs what Cui and the emperor were planning. When Cui realized this, he feared that the eunuchs would act against him first, and therefore wrote to Zhu, asking him to mobilize his troops and come to the capital to act against the eunuchs. In winter 901, the eunuchs, headed by Han, forced Emperor Zhaozong to flee to Fengxiang. Cui and Li Jizhao (who did not agree with the eunuchs) remained at Chang'an and waited for Zhu's arrival, and thereafter joined forces with him. Zhu evacuated Cui and the other imperial officials, as well as the remaining residents of Chang'an, to Hua Prefecture (which Han Jian had surrendered to Zhu as Zhu headed west toward Chang'an).
Zhu subsequently put Fengxiang's capital Fengxiang Municipality under siege, while attacking and seizing Li Maozhen's other possessions in the Guanzhong (i.e., Chang'an's surroundings) region. (During the siege, the eunuchs had Emperor Zhaozong issue an edict removing Cui and Pei from their chancellor positions, but the edict appeared to have no real practical effect.) By 903, Fengxiang was in dire straits due to the lack of food, causing its residents to resort to cannibalism. In desperation, the eunuchs sent out edicts in Emperor Zhaozong's name, ordering the other military governors to attack Zhu, but only Wang Shifan the military governor of Pinglu Circuit (平盧, headquartered in modern Weifang, Shandong) responded by planning a series of guerrilla attacks against a number of Zhu-held cities, including Hua Prefecture. Wang's officer Zhang Juhou (張居厚) was in charge of the attack on Hua Prefecture and was successful in killing the acting prefect Lou Jingsi (婁敬思), but Cui then took over the army and defeated Zhang; Zhang fled and was captured in flight.
Meanwhile, Li Maozhen, resolved to seek peace, killed Han and the other eunuchs, as well as Li Jiyun, Li Jihui, and Li Yanbi, sending their heads to Zhu. Zhu, however, while stopping the active siege efforts, did not initially end the siege. Li Maozhen then had Emperor Zhaozong summon Cui to Fengxiang and restore all of Cui's offices; Li Maozhen also personally wrote Cui in humble terms. Cui, initially fearing that it was a trap by Li Maozhen, refused, but Zhu, asking him to broker a peace agreement, persuaded him to do so. Subsequently, Li Maozhen delivered the emperor to Zhu, and Zhu and Cui escorted Emperor Zhaozong back to the capital. At Cui's and Zhu's urging, Emperor Zhaozong issued an edict ordering the general slaughter of the eunuchs, ending a lengthy period of power for the palace eunuchs. Cui was put in command of the imperial guards generally. Also at Cui's urging, the chancellors Su Jian and Lu Guangqi, who were commissioned by Emperor Zhaozong while Emperor Zhaozong was at Fengxiang and were Li Maozhen's allies, were ordered to commit suicide, while Wang Pu was removed from his chancellor position.
Zhu subsequently left Chang'an, but left a Xuanwu contingent at Chang'an, commanded by his nephew Zhu Youlun (朱友倫). While Cui and Zhu Quanzhong were longtime allies, Cui began to be apprehensive that Zhu intended to control the imperial government by himself and eventually take over the throne. Cui thus urged Emperor Zhaozong to allow him to reconscript soldiers for the imperial guards. In winter 903, Zhu Youlun died in an accident while playing polo — but Zhu Quanzhong became convinced that Cui was behind Zhu Youlun's death. He was also suspicious of Cui's intentions in rebuilding the imperial guards, and therefore had soldiers in his own army pretend to be new conscripts and join Cui's imperial guards, to watch what he was doing. In spring 904, Zhu submitted a petition to Emperor Zhaozong, accusing Cui and his associates Zheng Yuangui (鄭元規) the mayor of Jingzhao Municipality (京兆, i.e., the Chang'an region) and the army officer Chen Ban (陳班) of treason. Emperor Zhaozong, apparently under duress from Zhu, thereafter issued an edict demoting Cui to be an advisor to the Crown Prince, with his office at Luoyang. Soon thereafter, Zhu's soldiers surrounded Cui's mansions and put Cui to death, along with Zheng and Chen.