The history of lesbian, gay, and bisexual people in China spans thousands of years. Unlike the histories of European and European-ruled polities in which Christianity formed the core of heavily anti-LGBT laws until recent times, non-heterosexual states of being were historically treated with less animosity in Chinese states. For a period of the modern history of both the Republic of China and People's Republic of China in the 20th century, LGBT people received more stringent legal regulations regarding their orientations, with restrictions being gradually eased by the beginning of the 21st century. However, activism for LGBT rights in both countries has been slow in development due to societal sentiment and government inaction.

Ancient China Homosexuality has been documented in China since ancient times. Homosexuality was regarded differently among social classes and the sexes, meaning that it was at times acceptable but other times not.Passions of the Cut Sleeve: The Male Homosexual Tradition in China by Bret Hinsch; Review by: Frank Dikötter. Bulletin of the School of Oriental and African Studies, University of London, Vol. 55, No. 1(1992), Cambridge University Press, p. 170

The Intrigues of the Warring States, a collection of political advice and stories from before the Han dynasty, refers to Duke Xian of Jin (reigned 676–651 BC) planting a handsome young man in a rival's court in order to influence the other ruler and to give him bad advice.Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. p. 31. The historian Han Fei recorded a more exalted example in the relationship of Mizi Xia (彌子瑕) and Duke Ling of Wei (衛靈公). Mizi Xia's sharing of an especially delicious peach with his lover was referenced by later writers as Yútáo, or "the bitten peach". Another example of homosexuality at the highest level of society from the Warring States period is the story of Lord Long Yang and the King of Wei.Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. p. 32.

Imperial China

Scholar Pan Guangdan (潘光旦) came to the conclusion that many emperors in the Han dynasty had one or more male sex partners. Many were recorded in detailed biographies in the Memoirs of the Historian by Sima Qian and the Records of the Han by Ban Gu.Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. p. 36. Grand Historian Sima Qian notes that, unlike female wives and concubines, the male companions of the emperors were often admired as much for their administrative abilities as for their sexual abilities: — Those who served the ruler and succeeded in delighting his ears and eyes, those who caught their lord's fancy and won his favor and intimacy, did so not only through the power of lust and love; each had certain abilities in which he excelled. Thus I made The Biographies of the Emperors' Male Favorites. The proverb says, "No amount of toiling in the fields can compare to a spell of good weather; no amount of faithful service can compare to being liked by your superiors." This is no idle saying. Yet it is not women alone who can use their looks to attract the eyes of the ruler; courtiers and eunuchs can play at that game as well. Many were the men of ancient times who gained favor this way.Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. pp. 36.

The last of these emperors overlapped chronologically with "all but one" of the first fourteen Roman emperors held to be bisexual or exclusively homosexual by historian Edward Gibbon.Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. pp. 35–36. The Emperor Cheng of Han, also named Liu Ao, was a bisexual person. According to the Book of Han, he had a male lover named Zhang Fang. They were deeply in love with each other, but were forced to depart by Liu Ao's mother, the Grand Empress Dowager Wang. Besides this lover, he also had many famous empresses and imperial concubines, like Zhao Feiyan, Zhao Hede, Empress Xu and Ban Jieyu.

The Han emperor most strongly devoted to his male companion was Emperor Ai, who "by nature...did not care for women",Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. p. 52. and who attempted to pass the throne on to his lover, Dongxian (董賢).Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. p. 46. The story of Emperor Ai which most struck later writers, however, was when the Emperor carefully cut off his sleeve, so as not to awake Dongxian, who had fallen asleep on top of it. The cut sleeve was imitated by many people at court and became known as Duànxiù, or "breaking the sleeve". This phrase was linked with the earlier story of Mizi Xia's bitten peach to create the formulaic expression yútáo duànxiù (余桃断袖) to refer to homosexuality in general.

Throughout written Chinese history, the role of women is given little positive emphasis, with relationships between women being especially rare. One mention by Ying Shao, who lived about 140 to 206, does relate palace women attaching themselves as husband and wife, a relationship called dui shi. He noted, "They are intensely jealous of each other."Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. p. 174.

Except in unusual cases, such as Emperor Ai, the men named for their homosexual relationships in the official histories appear to have had active heterosexual lives as well. It is, in fact, impossible to know the full sexuality of any historical figures from most of Chinese history, unless they are indicated to be bisexual, since only affairs which were considered out of the ordinary were documented. Neither heterosexuality nor homosexuality were considered out of the ordinary for most of that history, so the fact that only one of the two was documented cannot rule out the other.Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. p. 42

The cases of Huo Guang, who served as regent of the Western Han, and General Liang Ji, who dominated the government of Han China in the 150's, are typical of bisexuals whose homosexuality would not have been mentioned had it not been seen as unusual in some way. Huo Guang was infatuated with his slave master, Feng Zidu, a fact that "provoked laughter in the wineshops of foreigners",Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. p. 49 but which didn't have much effect on his own countrymen. What did surprise them was when Huo Guang's widow took up with the slave master after her husband's death. For two lower-status individuals, one a woman and one a servant, to dishonor their master's memory in this way was considered shocking, and so the relationship was made note of.Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. pp. 49- 50

Similarly, General Liang Ji, had both a wife, Sun Shou, and a male slave, Qin Gong, who was acknowledged publicly with a status similar to a concubine. In this specific case, the relationship made it into the histories only because Liang Ji showed exceptional devotion to his wife, sharing the slave Qin Gong with her in a ménage à trois. It was not Liang Ji's bisexuality which was considered noteworthy, but rather the fact that he let two of his lower-ranking lovers enjoy each other instead of demanding that they each concentrate solely on him.

Two notable scholars, Ruan Ji and Ji Kang, were unique as egalitarian, long-term partners in the 3rd century. They were members of the anti-establishment Seven Sages of the Bamboo Grove, and their relationship reflected that group's vaunting of mystical, rustic, and simple life over the corruption, hierarchy, and intrigue at court. According to Lady Han, the wife of another sage of the Bamboo Grove, Shan Tao, who spied on the two in their bedroom, they were also sexually talented.

Writings from the Liu Song dynasty claimed that homosexuality was as common as heterosexuality in the late 3rd century: All the gentlemen and officials esteemed it. All men in the realm followed this fashion to the extent that husbands and wives were estranged. Resentful unmarried women became jealous.Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. p. 56 One of the earliest mentions of the actor-prostitutes who would become common later in Chinese history is also from the Jin dynasty.Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. p. 71

According to the Book of Jin, the Emperor Fu Jian, also the Shi Zu of Former Qin, used to take a beautiful princess and a prince together back to his palace, and loved them both. Years later, this prince Murong Chong organized an army, defeated Emperor Fu Jian and established a new empire.

Poems written by and for the future Emperor Jianwen of Liang also highlight the luxurious but ultimately degrading role of the male prostitute at the time.Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. pp. 72- 73

The aristocratic poet Yu Xin was representative of the more subtle system of patronage which existed without the stigma of prostitution, whereby a poorer or younger man could provide sexual service to a more established man in return for political advancement. Yu Xin opened his home and provided a standing reference for the younger Wang Shao, who repaid him by serving as a sort of butler and sex provider. Wang Shao went on to become an official censor.Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California. pp. 69

With the rise of the Tang dynasty, China became increasingly influenced by the sexual mores of foreigners from Western and Central Asia, and female companions began to accumulate the political power previously accumulated by male companions at the imperial court.Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. p. 77-78. At the same time, the actual power of the imperial court was in decline relative to intermediate rule by scholar-bureaucrats. The first negative term for homosexuality in Chinese- 'jijian', connoting illicit sexuality- appears at this time.Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. p. 88.

The following Song dynasty was the last dynasty to include a chapter on male companions to the emperors in official documents. In addition to Central Asian influence, the Song dynasty saw the first widespread adoption of Indian Buddhism, which derided sexuality in general.Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. p. 96. Increasing urbanization caused the monetization of all kinds of sexuality,Hinsch, Bret. (1990). Passions of the Cut Sleeve. University of California Press. p. 92. and the first law against male prostitutes, never effectively enforced, went into effect.

After the Song dynasty, homosexual behavior was most documented amongst the gentry and merchant classes, since these were the people who were doing most of the writing. Practically all officials of this class maintained a wife or wives to produce heirs, and used their economic advantage to engage in relationships, heterosexual and homosexual, which gave them unequal power.Brook, 233. Thus documentation focuses on male courtesans or "singing boys" in luxurious but decadent surroundings who must take on a female role to please wealthy patrons intent on maintaining their role as the masculine partner in the agreement.Brook, 231–233