Homosexuality has been documented in China since ancient times. According to one study by Bret Hinsch, for some time after the fall of the Han dynasty, homosexuality was widely accepted in China, but this has been disputed. Several early Chinese emperors are speculated to have had homosexual relationships accompanied by heterosexual ones.

There exists a dispute among sinologists as to when negative views of homosexual relationships became prevalent among the general Chinese population, with some scholars arguing that it was common by the time of the Ming dynasty, established in the 14th century, following homophobia entrenched in the Mongol empire and the Yuan dynasty, and others arguing that anti-gay attitudes became entrenched during the Westernization efforts of the late Qing dynasty and the early Republic of China in the 19th and 20th centuries.Robert Hans Van Gulik 1961. Sexual life in Ancient China: a preliminary survey of Chinese sex and society from ca. 1500 B.C. till 1644 A.D. Leiden: Brill.Needham, J: Science and Civilization in China: Sexual Techniques. Cambridge, England: Cambridge University Press, Vol. 2, 1954.Onon, Urgunge (2001) The Secret History of the Mongols: The life and times of Chinggis Khan. Abingdon: Routledge-Curzon. p.11. . "And anyone found indulging in homosexual practices should be executed." For most of the 20th century, homosexuality in China had been legal, except for a period between 1979 and 1997, when male anal sex was punishable as "hooliganism".

In a 2016 survey by the organization WorkForLGBT of 18,650 lesbians, gay, bisexual and transgender (LGBT) people, 3% of males and 6% of females surveyed described themselves as "completely out". A third of the men surveyed, as well as 9% of the women surveyed, said they were in the closet about their sexuality. 18% of men surveyed answered they had come out to their families, while around 80% were reluctant due to family pressure.

There was a step forward for China's LGBTQ+ community after the Weibo incident in April 2018, where the public outcry over the platform's ban on homosexual content led the platform to withdraw the decision. Yet, in 2021, Weibo and WeChat censored the accounts of numerous LGBTQ+ student organizations without any prior warning.

Terminology Traditional terms for homosexuality included "the passion of the cut sleeve" (), and "the divided peach" (). An example of the latter term appears in a 6th-century poem by Liu Xiaozhuo: — She dawdles, not daring to move closer, / Afraid he might compare her with leftover peach.Other, less literary, terms have included "male trend" (), "allied brothers" (), and "the passion of Longyang" (), referencing a homoerotic anecdote about Lord Long Yang in the Warring States period. The formal modern word for "homosexuality/homosexual(s)" is tongxinglian () or tongxinglian zhe (, homosexual people). Instead of that formal word, "tongzhi" (), simply a head rhyme word, is more commonly used in the gay community. Tongzhi (; sometimes used alongside nü tongzhi, ), was first adopted by Hong Kong researchers in Gender Studies, and is used as slang in Mandarin Chinese to refer to homosexuals. Such usage is seen in Taiwan. However, in mainland China, tongzhi is used both in the context of the traditional "comrade" sense (e.g., used in speeches by Chinese Communist Party officials) and to refer to homosexuals. In Cantonese, gei1 (), adopted from English gay, is used. "Gay" is sometimes considered to be offensive when used by heterosexuals or even by homosexuals in certain situations. Another slang term is boli (), which is not so commonly used. Among gay university students, the acronym "datong" (), which also refers to utopia in Chinese, is becoming popular. Datong is short for daxuesheng tongzhi (university students who are homosexuals).

Lesbians usually call themselves lazi () or lala (, ). These two terms are abbreviations of the transliteration of the English term "lesbian". These slang terms are also commonly used in mainland China now.

History

The story of Dong Xian, which details the same-sex relationship between Emperor Ai of Han and one of his male concubines, has been cited by Hinsch as evidence of the historical tolerance of homosexuality within the Chinese empire. However, critics have cited the fact that the relationship ended in tragedy and violence to argue that the story was therefore critical rather than supportive of homosexual relationships.

Ming dynasty literature, such as Bian Er Chai (), portrays homosexual relationships between men as enjoyable relationships. Writings from the Liu Song dynasty claimed that homosexuality was as common as heterosexuality in the late 3rd century:

Some scholars argue that Confucianism, being primarily a social and political philosophy, focused little on sexuality, whether homosexual or heterosexual. Critics have argued that under Confucian teachings, not having children was one of the greatest sins against filial piety, contending that while procreational bisexuality was tolerated, exclusive homosexuality was not. Emperors were still obligated to marry women and raise heirs, and same-sex sexual activities and relationships were merely tolerated as secondary practices. Confucian ideology did emphasize male friendships, and Louis Crompton has argued that the "closeness of the master-disciple bond it fostered may have subtly facilitated homosexuality".Crompton, Louis. Homosexuality and Civilization. Harvard University Press. p. 221

Although Taoist alchemy regarded heterosexual sex, without ejaculation, as a way of maintaining a male's "life essence", homosexual intercourse was seen as "neutral", because the act has no detrimental or beneficial effect on a person's life essence.

In a similar way to Buddhism, Taoist schools sought throughout history to define what would be sexual misconduct. Broadly speaking, the precept against "sexual misconduct" in Taoism relates to extramarital sex. The term for a married couple () usually in Chinese suggests a male with a female, though Taoist scripture itself does not explicitly say anything against same-sex relations./B.054 Many sorts of precepts mentioned in the Yunji Qiqian (), The Mini Daoist Canon, do not say anything against same-sex relations, maintaining neutrality. Opposition to homosexuality in China rose in the medieval Tang dynasty, but did not become fully established until the late Qing dynasty and the Chinese Republic. There exists a dispute among sinologists as to when negative views of homosexual relationships became prevalent among the general Chinese population, with some scholars arguing that it was common by the time of the Ming dynasty, established in the 14th century, and others arguing that anti-gay attitudes became entrenched during the Westernization efforts of the late Qing dynasty and the early Republic of China in the 19th and 20th centuries.

The Qing Dynasty had complex sociocultural interpretations of sexuality and sexual practices. On the one hand, the Manchurian Qing government revived Neo-Confucian cultural conservatism.Sommer, Matthew H. “Was China Part of a Global Eighteenth-Century Homosexuality?” Historical Reflections / Réflexions Historiques, vol. 33, no. 1, 2007, p. 118. JSTOR, http://www.jstor.org/stable/41299404. Accessed 8 May 2025. On the other hand, male homosexuality thrived in smaller sociocultural communities, such as monks, soldiers, and aristocrats.Sommer, Matthew H. “Was China Part of a Global Eighteenth-Century Homosexuality?” Historical Reflections / Réflexions Historiques, vol. 33, no. 1, 2007, p. 124. JSTOR, http://www.jstor.org/stable/41299404. Accessed 8 May 2025.

For Buddhist/Taoist monks, their hermit and secluded nature made it difficult for heterosexual practices. Soldiers found themselves in a similar position, but because of the Qing Dynasty's gendered draft. Male Qing aristocrats often financially supported male actors, prostitutes, or artists for sexual and/or romantic pursuits, although Confucian expectations for procreation always loomed over their sexual relationships.

In fact, the Qing law, in an attempt to promote Confucian ideals, discouraged all extramarital sex and outlawed all forms of homosexuality.Hinsch, Bret. Passions of the Cut Sleeve: The Male Homosexual Tradition in China. University of California Press, 1990. p. 144, https://doi.org/10.1525/9780520912656. Yet, Qing law enforcement for such practices was questionable at best, and many art forms, such as literature and erotic art, documented the widespread practice of homosexuality.Hinsch, Bret. Passions of the Cut Sleeve: The Male Homosexual Tradition in China. University of California Press, 1990. p. 146, https://doi.org/10.1525/9780520912656.

In Ancient Fujian, the region had developed a sexual culture isolated from that of the rest of the Chinese empire. During the Qing dynasty, the local population began worshipping a Taoist deity known as Tu Er Shen, who served as the guardian of same-sex love. The deity was originally a human by the name of Hu Tianbao. Hu was executed after having been caught peeping on a nobleman he had become attracted to. He was originally destined to go to hell, but the guardians of the spirit realm took pity on him, as his crime was committed out of love. He was then appointed as the guardian of same-sex love.

The Central Qing government of Beijing labeled followers of Tu Er Shen "cultists" and demanded their persecution and elimination. It was during this dynasty that China's very first law against non-commercial same-sex sexual conduct was enacted. However, the newly created offense of homosexuality carried the most lenient penalty possible in the Qing legal system. Today, the Wei-ming temple dedicated to Tu Er Shen, located in New Taipei, serves as the world's only religious temple dedicated exclusively to same-sex love.

The earliest law against a homosexual act dates from the Song dynasty, punishing "young males who act as prostitutes". The first statute specifically banning homosexual intercourse was enacted in the Jiajing era of the Ming dynasty.

Ming dynasty China banned homosexual sodomy (anal sex) in the Ming Code since the Jiajing emperor's reign and continued into the Qing dynasty until 1907, when western influence led to the law being repealed. The Chinese mocked and insulted Puyi and the Japanese as homosexuals and presented it as proof of their perversion and being uncivilized. The only time homosexual sodomy has been banned in Japan was for a short time for 8 years from 1872 to 1880 due to Western influence.

Lu Tonglin, author of Misogyny, Cultural Nihilism & Oppositional Politics: Contemporary Chinese Experimental Fiction, said: "A clear-cut dichotomy between heterosexuality and homosexuality did not exist in traditional China."

Male prostitution was forbidden during the Yuan dynasty (descended from the Mongol Empire) and the following Ming dynasty, and evidence suggests that there was a crackdown on homosexuality during this period as a continuation of the Mongol Empire’s hostility to homosexuality.

Same-sex relationships in literature Same-sex love can sometimes be difficult to differentiate in Classical Chinese because the pronouns he and she were not distinguished. And like many East and Southeast Asian languages, Chinese does not have grammatical gender. Thus, poems such as Tang dynasty poems and other Chinese poetry may be read as either heterosexual or homosexual, neutral in that regard, depending on the context.Samei, Maija Bell. (2004). Gendered Persona and Poetic Voice: The Abandoned Woman in Early Chinese Song Lyrics. Lexington Books. pp. 1.