Athletes and artists who identify as lesbian, gay, bisexual, transgender, pansexual, non-binary, queer, and/or intersex, and/or who have openly been in a same-sex relationship (LGBTQI+) have competed in the Olympic and Paralympic Games, either openly, or having come out some time afterward. 
Alongside the Olympics, international multi-sport events have also been organized specifically for LGBT+ athletes, including the EuroGames, Gay Games and World OutGames.
Ancient Olympic Games.
The concept of homosexuality did not exist, at least not as understood in the modern era, in Greece at the time of the ancient Olympic Games. Sexuality was defined by the role one took (active – "erastes" – or passive – in the case of homosexual relationships, "eromenos"), rather than by gender, and most men would have taken part in homosexual or pederastic activity. Social roles were connected with the sexual roles, with dominant and adult men to be active and women, young men, and those of low status to be passive. The passive role in men was associated with effeminacy, supposedly an undesirable trait in adults. However, sometimes these roles were flouted, with dominant adult men continuing to have homosexual relationships. Classicist Kenneth Dover has suggested that there would have been social stigma aimed at the passive male in an adult homosexual relationship.
David Stone Potter has discussed the prevailing sexuality in the culture of athletics in ancient Greece, saying that some gymnasiums had to ban men attending purely to pick up other men. Pederasty in sports was elegised by Theognis of Megara in writing "Happy is the lover who, after spending time in the gymnasium, goes home to sleep all day long with a beautiful, young man." Classicists have noted the development of a specific athletic pederasty in the seventh century BC, with Thomas F. Scanlon writing that "the high value placed on an athletic type of physical beauty and nudity contributed to the establishment of gymnnasia and the sanctioning of homosexuality among athletes". Scanlon suggested that widespread pederasty in Greece may have originally arisen due to the practice occurring frequently in gymnasiums, where it was more accepted.
Historians have also commented on elements of sexuality within the context of the ancient Olympic Games specifically. Author and Olympic historian Tony Perrottet has said that while Greek poets wrote odes to the bodies of the men, contemporaneous cultures like the Persians and the Egyptians thought the concept of naked men engaging in physical activity together "promoted sexual degeneracy". The ancient Olympic Games were undertaken in the nude, though this was not initially the case. Historians have connected this nudity to the tradition of men entering adulthood parading naked as a rite of passage. Emeritus professor Nick Fisher wrote that "men believed that nakedness… should reveal the perfection of the trained body and that an erotic response to muscular, bronzed bodies gleaming with olive oil, like statues, was a natural part of the admiration elicited by divinely gifted beauty and skills." Anthropologist Greg Laden described the ancient Olympics as "a softly pornographic group voyeuristic tournament".
Some Ancient Olympians noted for stigmatised adult relationships include the general and statesman Alcibiades, a successful Olympic chariot racer (taking first, second and fourth in 416BC) who had a much-studied relationship with Socrates, also notoriously having many mistresses; and "stadion" run winner Diocles of Corinth, who moved to Thebes to live with Philolaus of Corinth (of the Bacchiadae) and would be buried with him. In Thebes, Philolaus was a legislator who successfully advocated for adult male unions. Pythagoras of Samos was turned away from the boys' boxing contest and made to compete with the men, while being mocked for being effeminate; he also won the event. Gymnast Iccus of Taranto and "pankratiast" Kleitomachos were instead known for their abstinence, Kleitomachos supposedly to the point that he could not stand to even hear sex mentioned.
During the height of the popularity of the Olympics, many Greek athletes would spend significant periods of the Olympiad training in specific conditions – historian David Henry James Larmour noted ten months and Eusebius wrote that, during his time, it was sixteen months – including "apparently" having to abstain from sexual intercourse with women.
Summer Olympic Games LGBT+ history.
1896–1936.
Early years.
There is a recorded upsurge in both male and female homosexuality in France towards the end of the 19th century, with institutionalised homophobia increasing at the start of the 20th century in correlation. French academic and gay rights activist Louis-Georges Tin noted in 2008 that "from its origin, the Olympic movement produced homophobic residue", citing an essay written by modern Olympic Games founder Pierre de Coubertin from the time, in which Coubertin wrote that sport was the way to restore a man's correct "virile sensibility". Coubertin had previously proposed, in 1887, that school education should be more focused around sport to divert students from sexual perversion. In founding the modern Olympics, he did not allow provisions for women to compete, having said that women taking part in sport makes them ugly to men and so is unnatural.
Despite this, the first Olympic athlete known to be gay was a Frenchman from the "fin de siècle"; Robert de Montesquiou was a writer and socialite who also rode horses and won the bronze medal in the 1900 Hacks and hunter combined, the only time this event was contested. By 1912, there were few other gay Olympic athletes, one of whom was Niels Bukh, who coached his gymnastic team to a gold medal.
Interwar years.
LGBT+ Olympic historian Tony Scupham-Bilton traced gay Olympic athletes back to at least 1928 in a report produced for "Outsports" in 2016; the athlete in question was Weimar German runner Otto Peltzer, who lived openly gay, though this was not known worldwide; Peltzer set world records in the 1920s and was a prominent international athlete, but did not perform well at the Olympics. Peltzer was able to live openly within the Weimar Republic as, despite homosexuality technically being illegal, it flourished in culture and society of the interwar period, particularly in Berlin. One of the most prominent cultural figures in this period was Renée Sintenis, an openly queer and androgynous artist who won a bronze medal and would be one of seventeen known LGBT+ artists to compete in the artistic events at the Olympics in the interwar years, including fellow German gay icon Ludwig von Hofmann. 
A similar flourishing of gay life existed in certain urban communities of the United States in the 1920s, and there were also a significant number of LGBT+ Americans appearing at the Games during this period; Babe Didrikson Zaharias, a lesbian considered the 20th century's best female golfer, won two gold medals and a silver in athletics at the 1932 Olympic Games.
Nazi Olympics.
The impact of the rise of Nazism and its attitude towards homosexuality affected the Olympics in the run-up to and at the 1936 Olympic Games. In 1935, Peltzer was arrested, banned from sport, and eventually sent to a concentration camp. Sintenis lived in exile, with her artwork labelled Degenerate.
The Nazis took the chance to use their Games to promote some of their ideology through depicting the ideal Aryan man as a successful Olympic athlete. Since his first Games appearance, closeted sculptor Arno Breker had become a favourite of Adolf Hitler and was commissioned to produce statues for the Games. His artwork is known as both homoerotic and Nazi state propaganda, deliberately evoking ancient Greek aesthetics to promote the supposed Aryan physical supremacy; it reflects the homosocial masculine nature of the Nazi vision of utopia, which, paired with the classical sculptural nudity of antiquity, appeared like "a steamy wonderland in which the male body is always on view." Breker's statue for the Berlin Olympiastadion was recreated in miniature as his silver-medal-winning competition entry; the full size version features its nude decathlete holding a towel, while the smaller version does not. Another gay Olympian who was supported by Hitler and used for his propaganda was Bukh, invited to demonstrate his gymnastic programme and ideal male physique at the Games; Bukh's support of Nazism, potentially in light of Hitler's support of him, caused an unimpressed ex-lover to out him. Violette Morris, a French athlete of many sports who had long been openly lesbian, was another guest of Hitler's at the 1936 Games; she had been banned by her country from competing in 1928 because of her sexuality, and would later become a Nazi collaborator in occupied France.
Cultural superiority was also supposed to be on display at the 1936 Games, and also prominently involved LGBT+ Germans; artists other than Breker were encouraged by the Nazis to exhibit and compete for Nazi German glory. The famed dancers and choreographers Harald Kreutzberg, gay and androgynous, and Mary Wigman, probably bisexual, were the main architects of the showcase, which was run as a demonstration event. After the Games, Wigman was also labelled Degenerate.
At the 1936 Games, there were several noted incidents of sex verification among athletes in women's events. It was rudimentary, did not result in exclusions, and may have been biased; Helen Stephens said that, after she and Stella Walsh were both accused of being men, Hitler grabbed at her to confirm she was biologically female. It is not known if Walsh was similarly checked, but a later autopsy would show that Walsh had intersex characteristics, as did German athlete Heinrich Ratjen (competing as Dora Ratjen); Stephens and Walsh won medals, while Ratjen did not. Ratjen, who competed as female but identified as male, was later banned from sport by his country, though also claimed he had been made to compete as female so that Nazi Germany had a better chance of winning.
1948–1996.
Post-war period.
In 1948, the last artistic events were contested, and the last contemporaneously out Olympian would be seen until 1984. Mirroring society and the sporting world at large, the later decades of the 20th century saw significant homophobia as well as lack of sexual education; it has been reported that between 1950 and 1990, "many gay individuals... thought they were the only gay person in the world," which was also true among male Olympians. While homosexuality was no longer listed as an illness by the American Psychological Association from 1973, and activism emerged, there was widespread discrimination. The 1976 Summer Olympics held in Canada saw a programme called "ville propre", with police raiding gay bars and other known homosexual hang-outs, enforcing conservatism.
AIDS and Gay Games.
The AIDS epidemic, which officially began in 1981, saw a mixture of responses: from some parties there was more empathy for homosexual and bisexual men, and an outpouring of support; from others, there was an increased fear and vitriol, and sharing of the belief that AIDS was a divine punishment for a gay lifestyle.
The Gay Games, founded by gay former Olympian Tom Waddell, began in 1982, as a safe space for LGBT+ athletes to compete. The acceptance among athletes from the Gay Games is said to have crossed over into the Olympics; also including non-Olympic LGBT+ athletes, the Gay Games showed the world and Olympic movement that there are significant numbers of queer people in sport. Reportedly, being able to see "gay athletes in a highly organised event similar to the Olympic Games" caused attitudes to change in sport.
There was at least one contemporaneously out male LGBT+ athlete at each Summer Olympic Games from 1984 to 1996, with a steady increase over the period.
2000–present.
At the end of the 20th century, after the crest of the AIDS crisis, significant media attention in the United States was given to promoting LGBT+ equality, and positive cultural depictions of LGBT+ people returned to the mainstream in Western nations, which helped to normalise not just gay people, but moreover the act of coming out itself, to people in these countries. In the early years of the 21st century, various Western nations decriminalised sodomy and legalised civil partnerships and marriage for same-sex couples. Transgender activism took off, and the internet was said to be a useful tool for popularising and ultimately globalising equality movements.
Transgender athletes were first allowed to compete in 2004.
In the 2008 Summer Olympics in Beijing, only 15 athletes out of the 10,708 participants were openly gay, lesbian or bisexual. Of them only two, including Matthew Mitcham (who also won a gold medal, making him the first openly gay Olympic champion), were male. Mitcham gained media coverage in Australia as reporters thought he was the first Australian to