Cai Yong was born into a substantial local family in Chenliu (陳留, modern Qi County, Kaifeng, Henan), which had a reputation of not having their territory divided for three generations. When his father Cai Leng died, Cai Yong lived with his uncle Cai Zhi while taking great care for his own mother for her last three years. When she died, Cai Yong became known for his arrangement of his mother's tomb. After that, Cai Yong studied composition, mathematics, astronomy, pitch-pipes, and music under Hu Guang (胡廣), one of the highest-ranking officials in the Han court.
In the early 160s Cai Yong was recommended to the Emperor Huan by the senior eunuchs for his skill with the drums and the guqin. On his way to the capital, Cai Yong feigned illness to return home to study in seclusion. Ten years later in the early 170s, Cai Yong went to serve Qiao Xuan as a clerk, and Qiao Xuan greatly admired his abilities. Afterwards, Cai Yong served as a county magistrate and then a Consultant in the capital, in charge of editing and collating the text in the library. Known for his literary skills, he was constantly commissioned to write eulogies, memorial inscriptions, and the like.
In 175, in fear of parties trying to alter the Confucian classics to support their views, Cai Yong and a group of scholars petitioned to have the Five Classics engraved in stone. Emperor Ling approved, and the result was the Xiping Stone Classics (熹平石經), completed in 183, which set the canon for future generations of scholars.
Throughout his political career, he was an advocate of restoring ceremonial practices and often criticized against the eunuchs' influence in politics. He was successful in persuading the emperor to participate in a ritual in the winter of 177 through his memorials, but his attacks on the eunuchs were not so successful.
In the autumn of 178, the scholars were asked for advice on recent ill omens. Cai Yong responded with criticisms of eunuch pretensions. The eunuchs learnt of the attack, and accused Cai Yong and his uncle Cai Zhi of extortion. They were thrown into prison and sentenced to death, but the sentence was later remitted to exile in the northern frontiers. Nine months later, he cited to the throne that his work on the dynastic history and classics were at risk from enemy raids, and was allowed back to the capital. However, he offended the sibling of an influential eunuch during a farewell banquet before his return, which put his position in the capital at risk. Cai Yong fled south to the Wu (吳) and Guiji (會稽) commanderies and stayed there for twelve years.
When Dong Zhuo came to power in 189, he summoned Cai Yong back to the capital. At first Cai Yong was unwilling, but Dong Zhuo enforced his demand with the threat "I can eliminate whole clans", Cai Yong had no choice but to comply. Under Dong Zhuo, Cai Yong was made a General of the Household, and became in charge of revising rituals for Dong Zhuo's new government. Despite Dong Zhuo's admiration of Cai Yong as a scholar and musician, Cai Yong worried about Dong Zhuo's temper and once considered to return home, but was persuaded that he was too well known to escape.
In 192, when Dong Zhuo was killed in a plot by Wang Yun, Cai Yong was put into prison and sentenced to death for allegedly expressing grief at Dong Zhuo's death. Cai Yong and other government officials pleaded with Wang Yun to allow him to finish his work on the history of Han, but Wang Yun denied them, saying:
"In ancient times, Emperor Wu failed to kill Sima Qian, and so allowed him to write a book of slander which was passed down to later times. Particularly at this time, as the fortunes of the Emperor are in decline and there are war-horses in the suburbs, we cannot allow a treacherous minister to hold his brush among the attendants to a young emperor. It offers no advantage to the sage virtue of the ruler, and it will cause our party to suffer contempt and abuse."
It was said that Wang Yun eventually regretted this decision, but Cai Yong had already died in prison. After his death, pictures were set up in his honour, and commemorative eulogies were composed throughout his home county of Chenliu and the Yan province.
Due to the turmoil in China in the decade after his death, much of his work had been lost. However, Cai Yong had apparently entrusted the bulk of his library to his protégé Wang Can, and it is through his collection that Cai Yong's work can be found in compilations like the Book of Later Han. Few items of his work survive today.
His contributions include:The editing of the Xiping Stone Classics
The compilation of Dongguan Hanji (東觀漢記)
Duduan (獨斷) on ceremonial
Cai Yong bencao (蔡邕本草) on pharmacology
Nü Xun (女訓), advice for women
Qin Cao (琴操) on playing the guqin
Zhuan shi (篆勢) on the aspects of the traditional seal script
Grandfather: Cai Xi (蔡攜)
Father: Cai Leng (蔡棱)
Uncle: Cai Zhi (蔡質)
Cai Yan (Wenji), daughter
Daughter, personal name unknown, married to Yang Dao (羊衜)
Son, personal name unknown
Cai Xi (蔡襲), grandson
Yang Huiyu, granddaughter
Yang Hu, grandson
General of the Household of the Left (左中郎將)
Marquis of Gaoyang (高陽鄉候)
Cai Bojie is the main protagonist in the 14th-century play Tale of the Pipa by Gao Ming.