Homosexuality is still subject to the death penalty in many countries, particularly in the Middle East and Africa, while others allow gay marriage and adoption.
After Supreme Court in India decriminalised gay sex on Thursday, here is a broad overview of the situation around the world:
Africa: mostly a crime
Around 30 African countries ban homosexuality, with Mauritania, Somalia and Sudan having the death penalty for same-sex relations.
Gay sex is decriminalised in only a handful of countries: Chad, Democratic Republic of Congo, Gabon, the Ivory Coast, Mali and Mozambique.
South Africa is an exception, being the sole nation on the continent to allow gay marriage, which it legalised in 2006.
It also allows adoption, medically assisted procreation and surrogacy for homosexuals.
Middle East: repressed
Several countries in the conservative region still provide for the death penalty for homosexuality, including Saudi Arabia and the United Arab Emirates.
Israel leads the way in terms of gay rights, recognising same-sex marriages that are performed elsewhere although not allowing such unions in the country itself. Gay couples can adopt children.
There were massive demonstrations in Jerusalem and Tel Aviv in July to protest a law denying surrogacy rights to same-sex couples.
Lebanon is also more tolerant than other Arab countries.
Breakthrough in Asia
Much of Asia is tolerant of homosexuality, with remaining taboos gradually being eroded including in Vietnam and Nepal.
Taiwan is set to become the first place in the region to allow gay marriage after its highest court ruled in May 2017 that preventing same-sex unions was unconstitutional and gave authorities two years to legalise them.
The Philippines' top court in June started hearing arguments for the legalisation of gay marriage.
In China homosexuality was classified as a mental illness until 2001 and a crime until 1997. Conservative attitudes and discrimination remain widespread.
Homosexuality is outlawed by the region's Muslim countries, such as Bangladesh, Malaysia and Pakistan, where it is punishable imprisonment or lashes.
Europe: pioneers of gay marriage
In 2001 the Netherlands became the first country in the world to allow gay and lesbian couples to marry in a civil ceremony.
Fifteen European countries have followed, including Britain -- although not Northern Ireland, France and Germany, with Austria due to join in next year.
In 2014 Estonia became the first former Soviet republic to authorise same-sex civil unions, which are denied by eastern European countries.
In Russia homosexuality was considered a crime up to 1993 and a mental illness until 1999. A 2013 law punishes the promotion of homosexuality among minors.
Several western Europe countries also allow same-sex couples to adopt children and 10 permit medically assisted procreation for lesbian couples.
Progress in the Americas
Canada authorised same-sex marriage and adoptions in 2005, and 10 years later the United States legalised gay marriage nationwide.
Mexico's federal capital was the pioneer in Latin America, authorising gay civil unions in 2007 and marriages in 2009 as well as adoption.
Same-sex marriages and adoptions are also legal in Argentina, Brazil, Colombia and Uruguay.
Cuba plans a referendum on legalising same-sex marriage for February 2019.
Election Results for Lok Sabha Election 2019 will be out on May 23. Get the latest election news and live updates on ndtv.com/elections. Catch all the action on NDTV Live. Like us on Facebook or follow us on Twitter and Instagram for news updates from each of the 543 parliamentary seats for the election 2019