Before the rainbow was used as a symbol for LGBTQ+ community, a pink triangle was used, as seen on the album Age of Consent by Bronski Beat (released in 1984). This symbol was the one used for gay men by the German Nazi regime in the concentration camps during the war. A pink triangle pointing downwards was sewn onto the shirts of gay men in the concentration camps. In the 1970s, the symbol was reclaimed to identify liberation by the first gay rights organisation in Germany, HUW.

Harvey Milk was the first openly-gay politician elected to public office in California, he was elected to the board of supervisors, the legislative body. He commissioned Gilbert Baker to create the first rainbow flag for the 1978 San Francisco Pride. In the original flag, the colours were as follows: hot pink for sexuality; red for life; orange for healing; yellow for sunlight; green for nature; blue for art; indigo for harmony or serenity; and violet for the human spirit.

The flag has undergone transitions. Hot pink was dropped because it could not be mass produced at the time. Indigo was dropped for a protest parade when Harvey Milk was assassinated. More recently, in 2017, Philadelphia added black and brown to further promote inclusiveness and to support ethnic members of the LGBTQ+ community.

The flag is intended to represent inclusiveness and should never be used as a symbol of queer versus straight. In most cases, it is represented by the six colours, red, orange, yellow, green, blue and purple.