LGBT history in Hungary, while an increasingly debated political and civil rights issue, has received very little scholarly attention. Historians of Hungary have clearly ignored sexuality, especially queer or non-normative sexuality, with the exception of prostitution. Reasons for this, to a large extent, have to do with the availability of historical sources, with no historical memoirs and testaments of Hungarian LGBT people yet found and the 'Homosexual Registry' of the police lost or destroyed after 1989.

Early history In medieval Catholic Europe "sodomy" was often used as an accusation against political and ideological enemies, and a way to disgrace dead historical figures. According to the chronicler Jan Długosz, the defeat and death in Battle of Varna to the king of Hungary and Poland Władysław III of Poland (I. Ulászló), was a divine punishment for his sinful behavior. The chronicler wrote that before the battle the king in marium libidinem proclivus - „(was) inclined to masculine desires”, later described as disgusting and being against purity.It has been noted that it can be interpreted both as „desires of men” and as „desires for men” In modern works there are hypotheses, that "perhaps the king had a partner for a time, the several years older secretary Jan, son of Lviv castellan”.

King of Hungary Rudolf II dangled himself as a prize in a string of diplomatic negotiations for marriages, but never in fact married. During his periods of self-imposed isolation, Rudolf reportedly had affairs with his court chamberlain, Wolfgang von Rumpf, and a series of valets. One of these, Philip Lang, ruled him for years and was hated by those seeking favor with the emperor.Rowse, A. L. (1977). Homosexuals in History: Ambivalence in Society, Literature and the Arts. MacMillan Publishing Co., Inc. In addition, Rudolf was known to have had a succession of affairs with women, some of whom claimed to have been impregnated by him.Marshall, Peter (2006). The Magic Circle of Rudolf II: Alchemy and Astrology in Renaissance Prague. The emperor was the subject of a whispering campaign by his enemies in his family and the Catholic Church in the years before he was deposed. Sexual allegations may well have formed a part of the campaign against him.Trevor-Roper, Hugh; Princes and Artists, Patronage and Ideology at Four Habsburg Courts 1517–1633, Thames & Hudson, London, 1976, Trevor-Roper mentions many stories and rumours, but not those of Rudolf's homosexuality

His contemporary Voivode and then Prince of Transylvania Sigismund Báthory married Maria Christierna of Habsburg, a niece of Rudolph II in 1595. However, the marriage was never consummated and after wedding night Sigismund sent his wife to a fortress in Kővárgara, where she was kept as prisoner. Historian László Nagy notes that Sigismund's contemporaries made no reference to his relationship with women, implying that Sigismund was homosexual.

Austria-Hungary

Sex between men was criminalized according to the Hungarian Penal Code of 1878 (it consciously rejected Austria's approach, which criminalized both female and male homosexuality). Paragraph 241 of the Hungarian Penal Code criminalized sexual acts between men and bestiality as természetellenes fajtalanság (“unnatural fornication”) punishable by up to one year of fogház (the most lenient form of prison), while paragraph 242 declared non-consensual “crimes against nature” punishable by up to five years in prison, with potential life imprisonment if the act caused the death of the victim. The exact meaning of those terms was never concretely defined and remained open to different interpretation until its ultimate decriminalization in 1961. From the 1880s official accounts (government, police, or public health sources) intentionally avoided addressing the issue of female homosexuality.

Like in many other European places where homosexuality was unlawful at the time, criminalization did not prevent men from having sex and romantic relationships with other men. Authorities in Budapest were acutely aware of a growing queer culture in the rapidly developing and modernizing city. The Metropolitan Police in the late 1880s became one of the first police forces to create a “homosexual registry” as an integral part of Hungarian authorities’ efforts to establish a modern city. It took over two decades before the registry (along with the police itself) began to function more effectively. The exact date the registry was created is unknown, but it appears to have reached its final form in 1908, and as a consistent registry, have lasted at least until the decriminalization of homosexuality in 1961; however, there are also indications that it was actually in place until 1989. Most of the surviving info on the contents of the registry comes from the writings of 1930s doctors. In the beginning of 20th century the Budapest police found “worrisome that perversion between men is quite common in the capital,” and due to that they took responsibility for reducing and eliminating what they saw as the ill effects of same-sex sexuality and other sexual aberrations (such as blackmail, prostitution and other crimes). It appears that while the police kept recording homosexuals, it would only press charges in specific circumstances.

In 1908, the celebrated Hungarian writer published Homosexual Love, as a part of his crime novel series. The novel revolved around a tragic love story between two well-situated gentlemen, and now stands as one of the few Hungarian sources from this period that directly addresses same-sex love and sexuality. Others are the publications of investigative journalists and Vladimir Székely. In A Bűnös Budapest (Sinful Budapest) (1908), the first book collecting their reportages on the “real” Budapest, Tábori and Székely devoted a chapter to male same-sex sexuality entitled A Beteg Szerelem Lovagjai, (The Knights of Sick Love). Soon after the publication of Sinful Budapest Tábori and Székely published a second book, Bűnös Szerelem (Sinful Love), entirely and explicitly dedicated to queer sexuality. It also included writing about lesbians, presented as more private and less interested in creating a metropolitan subculture than their male counterparts.

Tábori and Székely's journalism work found that there was a formally established Hungarian homosexual association by the first decade of the twentieth century. It was not officially registered, as legally it could not have been. The club was based in Budapest but soon had “offices” in a number of cities within the Hungarian Kingdom, including Arad, Nagyvárad, Kolozsvár, Pécs, and Székesfehérvár. All the offices had subscriptions to a number of queer-friendly or exclusively homosexual publications, including German publication, Der Eigene, the first gay journal in the world.

Interwar period In 1919, when the Hungarian Soviet Republic was established for short, a new judicial system of Revolutionary Tribunals was created. The Experimental Criminology Department of the Budapest Revolutionary Tribunal took a novel effort to judge crime through the eyes of a comprehensive sociomedical approach that incorporated (new at the time) psychoanalytical theories, and the surviving documents bear witness to those aims. There are two surviving case studies of the Experimental Criminology Department that explicitly deal with sexuality, one with homosexuality. Those case files present the life circumstances of the accused, implying sexuality as malleable and unfixed, and sexual history (e.g. childhood assault) as an important determinant of people's action.

After establishing the Kingdom of Hungary, the official politics on family and sexuality changed to conservatism and praise of "traditional" bourgeois family model. Still, the Kingdom was a place of the scandal of Eduardina Pallavicini and Cécile Tormay, and the following divorce trial that sparked interest of both authorities and public and showed how scandals involving high society were also always about politics, this time involving two women prominent in Horthy's political circles. On October 30, 1923, Count Rafael Zichy filed for divorce with his wife, Countess Eduardina Pallavicini (daughter of the economist ), based on charges of an “unnatural” relationship between his wife and Cecilé Tormay. This relationship caused a great scandal at the time and was widely commented on by the contemporary press to the point that the two women, to protect their image, decided to sue Count Zichy who was eventually sentenced to one and a half years in prison. It was on the personal intervention of Miklós Horthy, invested in protecting an image of the woman who promoted his regime's conservative values.

In 1926, one of the first books to be fully devoted to the modern aspects of the ‘homosexuality problem’ was published in Budapest. Its author, Dr György Pál, described homosexuality as having recurred suddenly after World War I as a mass phenomenon and as a ‘burning issue of the modern era’ that could not be ignored in Hungary either. The rapid expansion of homosexual life, the ‘great homosexual tide flooding Budapest’,13 was presented as an inherent feature of global urbanization and as a parallel development to those shaping Budapest into a world-class metropolis. In Pál's estimate, by the 1920s the number of urnings was more than 10 000 in Budapest. They had several venues to meet and interact at, including bath houses and steam baths, as well as inner-city locations, most of which would remain popular cruising areas for several decades.

A few years later, a group of journalists and police officers published a two-volume work ‘The Modern Criminality’ (A modern bűnözés) with a whole chapter was devoted to homosexuality, written by the police superintendent József Vogl. He claimed that the proportion of homosexuals used to be 0.5% of the population, and after war increased to 1% and became even higher in big cities (while claiming no data had been collected previously so it could be not exactly determined). He also presented a statistical register, compiled between 1926 and 1929, of 2,000 homosexual men living in Budapest ‘whose homosexuality is undeniable’. This contained information on their ages, marital status, occupations and whether they had criminal records. Out of them 345 already had a criminal record, with only few convicted for homosexuality, and most for petty crimes, blackmail etc. Additionally, it was made clear that the 2,000 homosexual cases did not include any prostitutes. The police had a separate file on cases of homosexual prostitution: since 1924 more than 400 men had such a police record, including 281 recidivists.

In 1933, Jenő Szántó, a practicing doctor of the Royal Hungarian Public Health Institute, published two studies: one devoted to the issue of homosexual male prostitution based on a secret police file of 1932, containing a list of 1,695 male homosexual prostitutes, and another study on homosexuality in Budapest, with published statistics of 3,425 men from police registry in terms of their occupation, marital status, religion, and criminal history. Szantó pointed out that the number of known homosexuals had almost doubled since 1929, when the József Vogl had reported on the personal data of 2,000 homosexual men living in Budapest.

Renowned neurologist and psychiatrist, Zoltán Nemes-Nagy, published a book Tragedies in Love Life in 1933. It mentioned the existence of the registry, and also contained a case study of Nemes-Nagy's homosexual patient, Mr. K. It highlights K's “peculiar” sexual nature, and, first and foremost, it does so in a publication about so-called sexual pathologies. The placement of K's story in a book, which discusses all that could go wrong with love, posits K's homosexuality as a “tragedy.”