The lesbian, gay, bisexual and transgender (LGBT) community in San Francisco is one of the largest and most prominent LGBT communities in the world, and is one of the most important in the history of LGBT rights and activism. The city itself has, among its many nicknames, the nickname "gay capital of the world", and has been described as "the original 'gay-friendly city'". LGBT culture is also active within companies that are based in Silicon Valley, which is located within the San Francisco Bay Area.
San Francisco's LGBT culture has it roots in the city's own origin as a frontier-town, what SF State University professor Alamilla Boyd characterizes as “San Francisco’s history of sexual permissiveness and its function as a wide-open town - a town where anything goes". The discovery of gold saw a boom in population from 800 to 35,000 residents between 1848 and 1850. These immigrants were composed of miners and fortune seekers from a variety of nationalities and cultures, although over 95% were young men.
These transient and diverse populations thrust into a relatively anarchic environment were less likely to conform to social conventions. For example, with an unbalanced gender ratio, men often assumed roles conventionally assigned to women in social and domestic settings. Cross-gender dress and same-sex dancing where prevalent at city masquerade balls where some men would assume the traditional role of women going so far as to wear female attire. In her study “Arresting dress, cross-dressing in nineteenth century San Francisco”, Clare Sears also describes numerous cases of women who donned men’s clothing in public spaces for increased social and economic freedom, safety, and gender progressive experimentation. Cross-dressing is still an important part of LGBT culture in the city today.
The late 1800s saw a shift in the demographics of the city along with new social and political attitudes. Anti-vice campaigns emerged to target prostitution along with the criminalization of perceived gender transgressions including outlawing cross-dressing in 1863. Cross-dressing laws and public decency laws continued to inform LGBT culture and its interactions with law enforcement well into the 20th century. This political shift resulted in San Francisco’s queer culture remerging in bars, nightclubs, and entertainment of the Barbary Coast, removed from policing and control. Through the 1890s to 1907, the Barbary Coast, San Francisco’s early red-light district located on Pacific Avenue, featured same-sex prostitution and female impersonators who served male clientele.