Countries Where It’s Illegal to Be Gay: Penalties and Travel Risks

Roughly 64 countries criminalize consensual same-sex conduct as of 2025, and knowing which countries make it illegal to be gay is essential before any international trip. Twelve of those countries authorize the death penalty. Dozens more impose prison sentences ranging from a few months to life. A separate group prosecutes LGBTQ people through vague morality laws rather than direct bans, and a growing number now criminalize speech and advocacy alone, regardless of any conduct.

Countries That Authorize the Death Penalty

Twelve countries either impose or legally authorize execution for consensual same-sex conduct: Afghanistan, Brunei, Iran, Mauritania, Nigeria (in its northern states), Pakistan, Qatar, Saudi Arabia, Somalia, Uganda, the United Arab Emirates, and Yemen. Enforcement is uneven across this group, but the statutes are live law.

Iran is the most active enforcer. Its Islamic Penal Code prescribes execution for male same-sex intercourse, with documented executions carried out in recent years. Female same-sex conduct is punished primarily by 100 lashes, escalating to execution on a fourth conviction.

Saudi Arabia has no codified penal code covering these offenses. Judges apply Sharia law with broad discretion, and outcomes range from execution to flogging to imprisonment depending on the case and the judge.

Northern Nigeria operates under a different regime than the south. Twelve states — Bauchi, Borno, Gombe, Jigawa, Kaduna, Kano, Katsina, Kebbi, Niger, Sokoto, Yobe, and Zamfara — have adopted Sharia-based penal codes that make sodomy a capital offense for married people, punishable by stoning. Southern Nigeria applies the federal penal code, which uses prison terms.

Mauritania prescribes death by public stoning for adult Muslim men convicted of same-sex conduct. Yemen imposes execution on married men and flogging or imprisonment on unmarried men.

Brunei fully implemented its Syariah Penal Code Order on April 3, 2019, introducing death by stoning for male same-sex intercourse. Shortly after implementation, the Sultan announced that the country’s existing moratorium on the death penalty would extend to the new provisions. The law remains on the books but is not currently being enforced with executions.

Uganda’s Anti-Homosexuality Act, signed by President Museveni in 2023, imposes life imprisonment for the basic offense and the death penalty for “aggravated homosexuality,” a category that covers cases involving minors, people with disabilities, or repeat offenders. Promotion of homosexuality carries up to 20 years.

Countries That Impose Prison Sentences

Beyond the death-penalty group, dozens of countries punish same-sex conduct with imprisonment. Many of these statutes are inherited from British colonial-era penal codes that criminalized “carnal knowledge against the order of nature” or “gross indecency,” and they remain on the books nearly a century later.

Kenya’s Penal Code prescribes up to 14 years for “carnal knowledge against the order of nature” and up to five years for “gross indecency” between men, under provisions dating to 1930. Jamaica’s Offences Against the Person Act of 1864 criminalizes “buggery” between men with up to ten years of imprisonment and hard labor.

Tanzania is one of the harshest imprisonment regimes outside the death-penalty countries. Its penal code, amended in 1998, sets a minimum sentence of 30 years and a maximum of life. At least one person has received the 30-year sentence in recent years.

Malaysia punishes same-sex intercourse with up to 20 years of imprisonment plus whipping, with a separate two-year maximum for “gross indecency.”

Iraq passed an Anti-Prostitution and Homosexuality Law in 2024, banning same-sex relations and punishing anyone who “promotes homosexuality” with fines and imprisonment. Same-sex conduct had not previously been codified as a standalone offense there, and the law drew sharp criticism from the U.S. State Department.

Enforcement varies within this group. Some countries prosecute aggressively; others rarely bring cases but keep the laws available for harassment, extortion, and politically motivated arrests. Even where prosecutions are rare, the existence of the statute strips legal protection from anyone who might otherwise report violence or seek services.

A specific enforcement practice worth flagging: several countries, including Cameroon, Egypt, Kenya, Lebanon, Tunisia, Turkmenistan, Uganda, and Zambia, have used forced anal examinations as supposed evidence in sodomy cases. The World Medical Association condemned the practice in 2017 as scientifically baseless and a form of cruel treatment.

Prosecution Through Morality and Public-Decency Laws

Some countries have no explicit ban on same-sex conduct but prosecute LGBTQ people through broad morality statutes. Egypt is the clearest example. There is no Egyptian law that names homosexuality. Prosecutors instead use Law No. 10 of 1961, originally written against prostitution, which criminalizes “habitual debauchery” with three months to three years of imprisonment. The statute has become one of the most active tools of anti-LGBTQ enforcement in the region.

Similar morality-based approaches appear across the Middle East and North Africa. “Offenses against public morals” and “public decency” violations give police broad discretion to target individuals based on perceived identity rather than any specific documented act, and the vague wording makes legal defense difficult.

Digital Entrapment and Cybercrime Laws

Enforcement has moved online. Egyptian police have been documented creating fake profiles on dating apps like Grindr to identify targets, initiate conversations, and pressure them into in-person meetings. Officers sometimes push for agreement to exchange money for sex, because a financial element strengthens a “debauchery” prosecution. Fabricated screenshots and digitally altered photos have appeared as evidence in documented cases. Former Egyptian Interior Ministry officials have publicly acknowledged that officers are recruited to operate in the “virtual world” to identify same-sex gatherings.

Jordan’s 2023 Cybercrime Law expanded this environment further, criminalizing undefined “pornographic content” and material “promoting or inciting immorality” online with a minimum of six months’ imprisonment. The law also appears to prohibit VPNs and other anonymity tools.

Bans on LGBTQ Expression and Advocacy

A distinct category of law criminalizes not conduct but speech — making it illegal to discuss, portray, or advocate for LGBTQ rights, regardless of whether anyone engages in same-sex acts.

Russia introduced the modern version of this approach with Federal Law No. 135-FZ in 2013, banning distribution of “propaganda of non-traditional sexual relations” to minors. In late 2022, the government expanded the law to cover all ages, effectively criminalizing any public portrayal or positive mention of LGBTQ identities. Individuals face fines of roughly $6,500; organizations face penalties near $81,000 or forced closure. Russia’s foreign-agent regulations layer additional registration and labeling requirements on any group receiving foreign funding, tightening the squeeze on advocacy organizations.

Hungary’s Act LXXIX of 2021 prohibits making accessible to anyone under 18 any content that “propagates or portrays divergence from self-identity corresponding to sex at birth, sex change or homosexuality.” The restriction also covers advertising. Framed as child protection, it has restricted educational programs, media content, and public discussion.

Ghana has been advancing similar legislation. The Human Sexual Rights and Family Values Bill would impose a three-year jail term on people who identify as LGBTQ and five to ten years on anyone who promotes or advocates for LGBTQ rights. As of early 2026, the bill remains under consideration by Parliament’s Constitutional and Legal Affairs Committee and has not been signed into law. Its progression has already had a chilling effect on advocacy inside the country.

Countries That Have Recently Decriminalized

The picture is not moving in one direction only. Barbados and St. Kitts and Nevis both repealed their anti-sodomy laws in 2022, and the Cook Islands followed in 2023. India’s Supreme Court struck down its colonial-era Section 377 in 2018, though same-sex marriage remains unrecognized. These changes typically follow years of constitutional challenges on privacy and equality grounds.

What Travelers Should Know

If you are planning travel to any of these countries, start with the U.S. State Department’s destination-specific travel information. The Department maintains a page for LGBTQI+ travelers noting that more than 60 countries criminalize consensual same-sex relations and advising a close review of the “Local Laws & Customs” section for each destination. Many countries do not recognize same-sex marriage, and some immigration systems cannot process passports with an X sex marker.

Enrolling in the Smart Traveler Enrollment Program (STEP) before departure lets the nearest U.S. embassy contact you during emergencies, send security alerts, and coordinate evacuations. Registration is free, and information is protected under the Privacy Act. STEP is a communication tool, not a legal shield.

If you are arrested abroad, understand the limits of consular help before you need them. U.S. consular officers cannot get you out of detention, provide legal advice, represent you in court, pay legal fees, or tell a foreign court you are innocent. They can give you a list of local English-speaking attorneys, visit you in detention, contact your family with your permission, help ensure adequate medical care, and help transfer funds from people at home. You are fully subject to the laws of the country you are in, and the embassy cannot override those laws.

Practical device precautions matter. Delete dating apps and clear browser history before entering a country that criminalizes same-sex conduct or uses digital surveillance. Avoid carrying photos, messages, or other materials on your phone that could be treated as evidence. VPN use is itself restricted or illegal in some of these jurisdictions. Documented cases of app-based entrapment, phone searches at borders, and fabricated digital evidence mean the devices you carry can become the prosecution’s primary tool.