A line of men and women decked out in leather, leashes and lingerie waited to be flogged and spanked in an enclosed stage as hundreds of spectators watched and snapped photos Sunday.

It was just another day at the Folsom Street Fair, a celebration of all things kink and an annual San Francisco event since 1984. Tens of thousands of fans of bondage, discipline and sadomasochism — along with the merely curious — filled the South of Market street.

“It gives people the opportunity to experience something they might not otherwise feel safe doing,” said Beatrice Stone, who was coordinating the spanking and flogging to raise money for local charities. “If someone comes for the first time, we make sure it’s safe — we have experienced tops.”

Zack, 25, made a spur-of-the-moment decision to be flogged onstage. The South Bay resident, who declined to give his last name, said it was “pretty fun” — the organizers made sure he felt comfortable, and they checked in often to see that he was OK as his legs became weaker from the lashing.

“It’s great to have a space where we can come out and not feel so weird about being weird,” Zack said.

As the sun beat down on the self-proclaimed “world’s biggest leather event,” bare skin was on full display, with many people walking the street fully naked.

On one large stage in the middle of the festival, near-naked men simulated sex as the crowd called out suggestions. Nearby, dozens of people dressed up as dogs barked and howled in a large pen. At other booths, people were intricately bound in rope.

The fair, which had a suggested $10 entrance fee, raises money for community groups. The nonprofit that organizes it and other events says it has donated nearly $6 million to charities since the festival began.

While many of the booths were hawking sex toys, others were advocating for safer sex and services directed toward the LGBT community.

Black Brothers Esteem, a support program of the San Francisco AIDS Foundation that works with gay and bisexual African American men, was handing out condoms and information about HIV prevention.

Tony Bradford, the program’s assistant director of community engagement, said it was the program’s first year at the festival. The group decided to participate after hearing that the event had become more diverse, he said.

“People of color who used to be closeted kinky are out now,” said Bradford, who has been coming to the fair for years. “I’ve never seen a crowd here this diverse.”

Thierry Rocchia, 52, said he knew of the fair only from photos until he attended Sunday. He said he expected it would be rougher, but was pleasantly surprised by the “friendly and fun atmosphere.”

“There’s nothing like this in the United Kingdom, and I’m not sure we could have a festival like it there,” the London resident said.

Melvin Morgan, who has been coming to the Folsom Street Fair since the 1990s, said it has become more “touristy” over the years. But one thing hasn’t changed, he said: the fair’s body-positive atmosphere.

“People are walking around naked and bare, and I love that,” he said. “We came into this world naked, and that’s how it should be.”

Joaquin Palomino is a San Francisco Chronicle staff writer. Email: jpalomino@sfchronicle.com Twitter: @JoaquinPalomino