Sodomy laws in the United States were laws that made certain kinds of sexual activity illegal.  In the past, there were federal laws against sodomy.  Every state also had a sodomy law, even in the 20th century.

Starting in the 1960s, some states began to repeal (throw out) their sodomy laws.  In 2003, in a case called Lawrence v. Texas, the Supreme Court of the United States ruled that sodomy laws were unconstitutional.  This means no sodomy law in the United States can be used to charge a person with a crime.

Types of laws
Most sodomy laws in the United States made both oral sex and anal sex illegal.  However, state laws did not agree on who could not do these things.

Every state law made sodomy between homosexual couples illegal.  Other state laws also made sodomy illegal between heterosexual couples, if they were not married.  The strictest laws made sodomy illegal in every case, even between married couples.

Some sodomy laws also included bestiality in their definition of "sodomy."

Creation of sodomy laws

The first sodomy laws in America were created when America was still a colony of the British Empire.  In the Jamestown colony (the first permanent settlement in America), sodomy could be punished by execution.

Sodomy could be punished by execution in many of the other American colonies as well.  In cases of rape or statutory rape, the victim was often punished also.  Sometimes the victim was executed along with their rapist.

Historians are not sure exactly how many people were executed for sodomy in colonial America:
 In the 1600s, when executions for sodomy were most common, there may have been five or ten people executed for sodomy (including bestiality)
 From 1700 to independence in 1776, there may have been five more executions for sodomy (including bestiality)
 Historian Anne-Marie Cusac says that about fifty people were executed in the American colonies for sexual crimes (though these crimes included rape as well as sodomy)

By the time the Bill of Rights was ratified in 1791, every state in the new United States had laws that treated sodomy as a crime.

Punishments

Before 1963, every state in the United States had laws against sodomy.  The states did change these laws so that sodomy was no longer a capital crime.  However, punishments could be as severe as life in prison.

Ethics scholar Richard Weinmeyer writes:

According to the Mattachine Society, one of the oldest gay rights groups in the United States, these were the punishments for breaking sodomy laws in 1964:

Repeals begin
In the 1960s, attitudes toward sex became much more liberal in the United States.  As this happened, some states began to repeal their sodomy laws.  Illinois was the first state to do this, in 1963.  In the 1960s and 1970s, seventeen other states repealed their sodomy laws.  Another seven states changed their laws to say that sodomy between heterosexual couples was not a crime.  These seven states kept laws that made sodomy between homosexual couples a misdemeanor.

However, some states refused to change their laws.  In 1986, the United States Supreme Court ruled that sodomy laws were constitutional, and that states could continue to use them.

Lawrence v. Texas
By 2003, thirty-one of the fifty states had repealed their laws against sodomy.  Fifteen states had laws left that made sodomy a crime.  Four more had laws that made sodomy between same-sex couples a crime.

In 2003, the United States Supreme Court made a landmark decision in Lawrence v. Texas.  It ruled that Texas's sodomy law was unconstitutional.  This ruling meant that no sodomy law in the United States was constitutional or could be used to charge a person with a crime.  In other words, it made sexual activity between homosexuals legal in every state in America.

At this time, nineteen states still had sodomy laws that they had not repealed.

Some states refuse to repeal
As of 2019, a total of 15 states had not repealed their sodomy laws, even though they cannot be used any more because of Lawrence v. Texas.  Twelve of these state laws make both heterosexual and homosexual sodomy illegal:

Three more of these state laws ban homosexual sodomy specifically: Kansas, Kentucky, and Texas.

Since the ruling, 4 states have repealed their sodomy laws:

 Montana (directed only at homosexual sodomy via a common law definition) (repealed in 2013)
 Virginia (repealed in 2014)
 Utah (repealed in 2019)
 Alabama (repealed in 2019)

Notes

References

LGBT rights
LGBT in the United States
United States federal legislation