Records of men who have sex with men in Japan date back to ancient times. Western scholars have identified these as evidence of homosexuality in Japan. Though these relations had existed in Japan for millennia, they became most apparent to scholars during the Tokugawa (or Edo) period. Historical practices identified by scholars as homosexual include , and .

The Japanese term is the Japanese reading of the same characters in Chinese, which literally mean "male colors". The character () has the added meaning of "lust" in both China and Japan. This term was widely used to refer to some kind of male-to-male sex in a pre-modern era of Japan. The term is also used, especially in older works.

Homosexuality in Japan

During the Meiji period nanshoku started to become discouraged due to the rise of sexology within Japan and the process of westernization.

Homosexuality in Japan

Modern terms for homosexuals include , , , or , , / and .

Homosexuality in Japan

Pre-Meiji Japan

Historically, the Shinto religion "had no special code of morals and seems to have regarded sex as a natural phenomenon to be enjoyed with few inhibitions." While Shinto beliefs are diverse, Japanese Shintoism does not condemn homosexuality. A variety of obscure literary references to same-sex love exist in ancient sources, such as Japanese mythology, but many of these are so subtle as to be unreliable; another consideration is that declarations of affection for friends of the same sex were common.

Nevertheless, references do exist, and they become more numerous in the Heian period, roughly in the 11th century. For example, in The Tale of Genji, written in the early 11th century, men are frequently moved by the beauty of youths. In one scene the hero rejects a lady and instead sleeps with her young brother: "Genji pulled the boy down beside him ... Genji, for his part, or so one is informed, found the boy more attractive than his chilly sister". The Tale of Genji is a novel, but there are several Heian-era diaries that contain references to homosexual acts and practices. Some of these contain references to Emperors involved in homosexual relationships with "handsome boys retained for sexual purposes".

Monastic homosexuality

Nanshoku relationships inside Buddhist monasteries were typically pederastic: an age-structured relationship where the younger partner is not considered an adult. The older partner, or , would be a monk, priest or abbot, while the younger partner was assumed to be an , who would be a prepubescent or adolescent boy; the relationship would be dissolved once the boy reached adulthood (or left the monastery). Both parties were encouraged to treat the relationship seriously and conduct the affair honorably, and the nenja might be required to write a formal vow of fidelity. Outside of the monasteries, monks were considered to have a particular predilection for male prostitutes, which was the subject of much ribald humor.

There is no evidence so far of religious opposition to homosexuality within Japan in non-Buddhist traditions. Tokugawa commentators felt free to illustrate kami engaging in anal sex with each other. During the Tokugawa period, some of the Shinto gods, especially Hachiman, Myoshin, Shinmei and Tenjin, "came to be seen as guardian deities of nanshoku" (male–male love). Tokugawa-era writer Ihara Saikaku joked that since there are no women for the first three generations in the genealogy of the gods found in the Nihon Shoki, the gods must have enjoyed homosexual relationships—which Saikaku argued was the real origin of nanshoku. Nonetheless, during the Edo period, male-female relationships were highly valued as it ensured propagation of offspring and social status.

Samurai shudō

In contrast to the norms in religious circles, in the warrior (samurai) class it was customary for a boy in the wakashū age category to undergo training in the martial arts by apprenticing to a more experienced adult man. According to Furukawa, the relationship was based on the model of a typically older nenja, paired with a typically younger chigo. The man was permitted, if the boy agreed, to take the boy as his lover until he came of age; this relationship, often formalized in a "brotherhood contract", was expected to be exclusive, with both partners swearing to take no other (male) lovers.