How Many Countries Is It Still Illegal to Be Gay?

Sixty-four United Nations member states still have laws on the books that make consensual same-sex sexual acts between adults a crime, according to ILGA World’s 2025 review of national criminal codes.1ILGA World. Pride Month: ILGA World Releases New Data and Maps on Laws Affecting LGBTI People Globally Penalties across those countries where being gay is illegal run from fines and short jail terms to life imprisonment, and in at least a dozen jurisdictions, the death penalty is either imposed or legally possible. That figure only reflects countries with explicit criminal statutes. A handful of others prosecute the same conduct under vague morality or public-order laws without naming it in their penal codes.

What the 64-Country Figure Actually Counts

ILGA World arrives at 64 by reviewing every UN member state’s criminal code and flagging any statute that prescribes a penalty for consensual sexual acts between adults of the same sex. The wording differs from place to place: “sodomy,” “unnatural offenses,” “carnal intercourse against the order of nature,” “gross indecency.” The common thread is that private, consensual conduct between adults is treated as a crime.2ILGA World Database. Criminalisation of Consensual Same-Sex Sexual Acts

The real number of countries where you can be prosecuted is arguably higher. Egypt has no statute that mentions homosexuality by name. Authorities instead rely on a law originally aimed at sex work, charging people with “debauchery” or public-morality violations. Police have been documented creating fake profiles on dating apps, initiating conversations, and pressuring targets into meetings that end in arrest. Convictions carry jail time. The government has publicly acknowledged using online surveillance to target what it calls “homosexual gatherings.”

Several other countries operate in the same gray zone, using vagrancy statutes or public-indecency provisions that give police wide discretion to target people based on perceived sexual orientation. These jurisdictions don’t appear in the 64-country count but can be just as dangerous in practice.

Where the Death Penalty Applies

The death penalty is the legally prescribed punishment for same-sex acts in seven UN member states. In five additional countries, the law is ambiguous enough that the death penalty remains a legal possibility without full certainty.1ILGA World. Pride Month: ILGA World Releases New Data and Maps on Laws Affecting LGBTI People Globally

The clearest cases include:

  • Iran. The Islamic Penal Code punishes penetrative same-sex acts between men with death, and there is significant evidence of enforcement, including recent executions.3United Nations Office on Drugs and Crime. Islamic Penal Code of the Islamic Republic of Iran
  • Saudi Arabia. The legal system applies an uncodified interpretation of Islamic law under which married persons convicted of sodomy face death by stoning, and unmarried persons face 100 lashes. Conviction technically requires four male witnesses, but prosecutions proceed through other evidentiary channels as well.4Immigration and Refugee Board of Canada. Saudi Arabia: Treatment of Homosexuals by Authorities and by Society in General
  • Mauritania. Article 308 of the Penal Code prescribes death by public stoning for Muslim men found guilty of same-sex conduct, though Mauritania has observed a de facto moratorium on executions since 1987.5Immigration and Refugee Board of Canada. Mauritania: The Treatment of Sexual Minorities by Society and the Authorities
  • Yemen, northern Nigeria, and parts of Somalia. Regional or national criminal codes rooted in religious law prescribe death for same-sex acts, with enforcement varying by locality.

Several other countries fall into the legally possible category. Brunei’s Sharia Penal Code, fully enacted in 2019, prescribes stoning for anal sex. Afghanistan, under Taliban rule since 2021, enacted the Propagation of Virtue and Prevention of Vice Law in 2024, which codifies enforcement powers that include punishments at the enforcer’s discretion. The underlying penal code allows for the application of Islamic law, under which the maximum penalty is death. Pakistan, Qatar, and the United Arab Emirates also have legal frameworks where the death penalty is theoretically available, though documented executions specifically for consensual same-sex acts are rare or unconfirmed.

Uganda joined this group in 2023 when its parliament passed the Anti-Homosexuality Act, which imposes the death penalty for “aggravated homosexuality.” That category covers situations involving HIV transmission, acts against people with disabilities, or repeat offenses.6Parliament of the Republic of Uganda. The Anti-Homosexuality Act, 2023 Uganda’s Constitutional Court largely upheld the law in 2024, striking down only four provisions unrelated to the core criminalization or death penalty clauses.7Judiciary of Uganda. Constitutional Court Pronounces Itself on the Anti-Homosexuality Act, 2023 of Uganda

Prison Sentences and Other Penalties

Outside the death-penalty jurisdictions, sentences generally fall into two tiers: up to eight years, or ten years to life.2ILGA World Database. Criminalisation of Consensual Same-Sex Sexual Acts The higher end is common in former British colonies that inherited life-imprisonment provisions through colonial-era sodomy laws. Countries in the lower tier often impose sentences of a few months to several years, sometimes alongside fines or corporal punishment like flogging.

The gap between what the statute says and how it is enforced varies enormously. In some countries, prosecutions are rare and the laws sit dormant on the books. In others, police actively investigate and arrest people. A dormant law is not a safe law. Statutes that aren’t routinely enforced can still be weaponized during political shifts, used as leverage for extortion, or selectively applied against vulnerable people. The threat of prosecution shapes behavior even when actual charges are uncommon.

Many of these statutes only target men. Uzbekistan and Turkmenistan, for example, specifically criminalize sodomy between men while their penal codes say nothing about sexual conduct between women. That reflects the drafting of the colonial-era originals, which centered on male acts. The absence of an explicit statute does not always mean safety, though. Authorities in some countries prosecute women under broader morality or public-order laws, and a few countries have expanded to catch-all “gross indecency” language that applies regardless of gender.

Regional Patterns

Criminalization is not evenly distributed. It clusters in three regions: sub-Saharan Africa, the Middle East and North Africa, and parts of South and Southeast Asia. The reasons behind each cluster differ.

Africa

More than half of Africa’s 54 countries criminalize same-sex conduct.8European Parliamentary Research Service. LGBTI in Africa Most of these laws trace directly to colonial-era penal codes. The British Empire exported variations of Section 377 of the Indian Penal Code, which criminalized “carnal intercourse against the order of nature,” to colonies across Africa, South Asia, Southeast Asia, and the Caribbean.9The National Archives. LGBTQ+ Rights in Britain – Source 4 Britain itself repealed these provisions decades ago; many of its former colonies never did. In some African countries, political leaders have strengthened colonial-era laws rather than repealing them, framing homosexuality as a Western import even though the laws themselves were the actual import.

The Middle East and North Africa

This region has the highest density of criminalization, driven largely by the integration of religious legal principles into national criminal codes. Iran, Saudi Arabia, and Yemen derive their penalties directly from interpretations of Islamic law. Egypt relies on secular-coded morality statutes that accomplish similar goals without explicit religious framing. Reform efforts here face the additional hurdle of challenging religious authority alongside legal authority.

The Caribbean

Several Caribbean nations retain “buggery” laws inherited from British colonial rule. These have been the focus of a recent wave of successful constitutional challenges, particularly in the Eastern Caribbean, where courts have struck them down as violations of privacy and expression rights. That momentum has not yet reached every island, and enforcement patterns vary.

South and Southeast Asia

The Section 377 legacy persists across this region as well. India’s Supreme Court read down its version in 2018, but Bangladesh, Myanmar, Malaysia, and Sri Lanka retain their versions in some form. Enforcement ranges from active to effectively dormant.

Laws That Criminalize Advocacy, Not Just Acts

A growing number of countries have moved beyond criminalizing same-sex conduct to outlawing speech, expression, and organizing around LGBTQ+ issues. These “propaganda” or “promotion” laws can affect foreign travelers, journalists, and organizations operating in-country.

Russia expanded its propaganda law in late 2022, moving from a ban on sharing information about “non-traditional sexual relations” with minors to a blanket prohibition covering all audiences. The law imposes fines for individuals and significantly larger fines for organizations. Russia does not criminalize same-sex acts themselves, but the propaganda law silences public discussion and advocacy.

Iraq passed a sweeping amendment in April 2024 that punishes same-sex relations with 10 to 15 years in prison. The same law imposes up to seven years for “promoting homosexuality,” a term left undefined, and one to three years for gender-affirming medical procedures. The vagueness of the promotion clause gives authorities broad discretion.

Ghana’s parliament has repeatedly attempted to pass the Human Sexual Rights and Family Values Bill, which would impose prison terms of up to three years for same-sex acts and six to ten years for producing materials or participating in organizations deemed to promote LGBTQ+ activities. The bill passed parliament in early 2024 but expired without presidential signature. It was reintroduced in 2026, and the current president has signaled support.

Countries Tightening Their Laws

The direction of change is not one-way. Several countries have recently added or expanded anti-LGBTQ+ criminal provisions:

  • Uganda (2023). The Anti-Homosexuality Act introduced some of the world’s harshest penalties, including death for “aggravated homosexuality” and life imprisonment for the underlying offense. The Constitutional Court upheld the core provisions in 2024.6Parliament of the Republic of Uganda. The Anti-Homosexuality Act, 2023
  • Iraq (2024). Parliament amended an existing anti-prostitution law to add penalties of 10 to 15 years for same-sex relations, plus separate provisions criminalizing advocacy and gender-affirming care.
  • Russia (2022-2023). Expanded its propaganda law from targeting speech directed at minors to a blanket ban covering all audiences, with escalating fines for repeat offenses.
  • Ghana (ongoing). Parliament has pushed the Human Sexual Rights and Family Values Bill through multiple legislative sessions. Reintroduction in 2026 with presidential backing suggests continued momentum.

Countries That Have Recently Decriminalized

A steady stream of court rulings and legislative reforms has also been shrinking the list, particularly in the Caribbean. Major changes since 2022:

Most of the Caribbean rulings relied on constitutional protections already embedded in these countries’ founding documents, arguing that colonial-era criminal provisions never should have survived the transition to independence. Legal challenges remain active in several other Caribbean and Commonwealth nations.

If You’re Traveling to a Country on This List

The U.S. State Department maintains a dedicated page for LGBTQI+ travelers and recommends reviewing the Local Laws and Customs section of each destination’s country information page.16U.S. Department of State. Gay and Lesbian Travelers Those sections contain destination-specific warnings about legal risks and social conditions that go beyond the general travel advisory level.

The State Department also recommends enrolling in the Smart Traveler Enrollment Program (STEP), which sends email updates from the local U.S. embassy or consulate and helps the embassy contact you in an emergency. For countries with active enforcement, this is worth doing regardless of how brief the trip is.

A few practical realities the advisory pages don’t always spell out. In countries that use morality or debauchery statutes rather than explicit bans, the risk can be harder to assess. Police in some jurisdictions monitor dating apps, create fake profiles, and use conversations as evidence. Even where the law technically targets only nationals, foreign visitors have been arrested and detained. The legal protections you expect at home do not travel with you.

Asylum in the United States for People Fleeing These Laws

U.S. immigration law defines a refugee as someone who cannot return to their home country because of a well-founded fear of persecution on account of race, religion, nationality, political opinion, or membership in a particular social group.17Office of the Law Revision Counsel. 8 U.S. Code 1101 – Definitions Since 1994, federal immigration courts have recognized sexual orientation as a basis for membership in a particular social group, meaning people fleeing countries that criminalize homosexuality can apply for asylum in the United States.

The standard requires demonstrating either past persecution or a well-founded fear of future persecution. Living in a country where same-sex acts carry prison time or death is strong evidence, but applicants still need to show the risk is personal and not purely theoretical. Evidence can include prior arrests, threats, physical violence, or documented enforcement patterns in the home country. Applicants do not need to prove they are actually gay; someone persecuted because others perceive them as gay qualifies under the same framework.

Asylum applications must generally be filed within one year of arriving in the United States, with limited exceptions. The process involves an interview with an asylum officer or, if referred, a hearing before an immigration judge. Given the complexity and the stakes, legal representation significantly affects outcomes.