Accounts of transgender people (including non-binary and third gender people) have been identified going back to ancient times in cultures worldwide. The modern terms and meanings of "transgender", "gender", "gender identity", and "gender role" only emerged in the 1950s and 1960s. As a result, opinions vary on how to categorize historical accounts of gender-variant people and identities.
In Ancient Greece, Phrygia, and Rome, there were galli priests that some scholars believe to have been trans women. Roman emperor Elagabalus (d. 222 AD) preferred to be called a lady (rather than a lord) and sought sex reassignment surgery, and in the modern day has been seen as a trans figure. Hijras on the Indian subcontinent and kathoeys in Thailand have formed trans-feminine third gender social and spiritual communities since ancient times, with their presence documented for thousands of years in texts which also mention trans male figures. Today, at least half a million hijras live in India and another half million in Bangladesh, legally recognized as a third gender, and many trans people are accepted in Thailand. In Arabia, khanith today (like earlier mukhannathun) fulfill a third gender role attested since the AD 600s. In Africa, many societies have traditional roles for trans women and trans men, some of which survive in the modern era. In the Americas prior to European colonization, as well as in some contemporary North American Indigenous cultures, there are social and ceremonial roles for third gender people, or those whose gender expression transforms, such as the Navajo nádleehi or the Zuni lhamana.
In the Middle Ages, accounts around Europe document transgender people. Kalonymus ben Kalonymus's lament for being born a man instead of a woman has been seen as an early account of gender dysphoria. Eleanor Rykener, a male-bodied Briton arrested in 1394 while living and doing sex work dressed as a woman, has been seen as a trans woman. In the Balkans since the 1400s, female-assigned people have transitioned to live as men called sworn virgins.