For more than a century, San Francisco’s Union Square has beckoned shoppers to high-end department stores and a riotous mix of fashion sellers able to pay the area’s sky-high retail rents.

It has long been the city’s glamorous retail hub, where shoppers go not only to buy but to soak up some urban sophistication.

Now, with sales shifting online and concerns mounting about homelessness and crime, the square’s edges are fraying.

Forever 21, a fast-fashion chain that has been a fixture in the neighborhood for 15 years, announced plans this week to close its three-story flagship at 2 Stockton St., one of the area’s grandest buildings, as the company undergoes bankruptcy restructuring. Gump’s, the legendary department store, closed last year, and other vacancies dot the area.

The 2 Stockton building is “a large footprint and right at the gateway of our district,” said Karin Flood, executive director of the Union Square Business Improvement District. “If they close, it will be impactful.”

Union Square has a 6% retail vacancy rate, up from 2% in 2014, according to CoStar Group, a real estate market research firm. And the numbers don’t count one major building to fill, the remake of 100 Stockton St., “which theoretically would more than double” vacancy in and around the square, said Jesse Gundersheim, San Francisco director of market analytics at CoStar.

100 Stockton St. is the site of the former Macy’s men’s building, which Morgan Stanley bought in 2016 for $275 million. The investment bank and its development partner, Blatteis & Schnur, are planning to partially convert the upper floors to office space. Last fall, Macy’s opened a smaller men’s store in its main building on Union Square.

Other vacancies include 222 Sutter St., where another bankrupt clothing and accessories retailer, Loehmann’s, stood. The building has been empty for almost five years. At least four smaller empty stores pepper Powell Street.

Real estate firm Cushman and Wakefield, which represents the space that Forever 21 plans to vacate, declined to comment on future plans.

Union Square’s woes echo those of shopping centers everywhere: Interest in large stores is fading, and in San Francisco, the high cost of rent and labor, as well as concerns about homelessness and crime in the area, deter prospective tenants. Central Subway construction has also affected retailers and other businesses.

The effect of shuttered stores is two-fold, according to Flood of the Union Square Business Improvement District.

“For shoppers, they want to see shopping districts with stores that are open and inviting, and when they see one empty shop after another, it makes people wonder what’s happening,” she said.

At times, she’s seen a domino effect of businesses leaving simply because others have left.

At 135 Post St., a building previously occupied on three floors by Gump’s, representatives for the building are contemplating carving out the space to offer tenancy to four or more businesses instead of trying to get one tenant.

“We have the flexibility and are beginning to develop drawings and scenarios that divide the space creatively for several users,” said Pam Mendelsohn of Maven Realty, the leasing agent for the space. “But we want to curate the mix so that they work well together, and create the energy and excitement that’s really appropriate.”

There’s also continued tension in the neighborhood over the conversion of retail space to office space — a recognition of the reality that some physical stores will not survive the e-commerce wave. Union Square has strict zoning rules protecting retail, but in January, the San Francisco Board of Supervisors made it a little easier for offices to creep in. The board passed an ordinance allowing for the conversion of third-floor retail space to office space, contingent on a conditional use permit and the city Planning Commission’s approval. The rest of the upper floors can be converted to office space from retail without those requirements with $6-a-foot conversion fee. The ordinance prohibits non-retail uses on the first two floors of Union Square buildings.

“We would like to make room for office, especially on those upper floors,” Flood said. “We would rather fill vacancies than let places sit empty.”

For Fillmore resident Allison Sherwood, 28, who shopped at Forever 21 during her teen and college years, the news of the latest closure came as a surprise. Forever 21, which is headquartered in Los Angeles, grew in popularity as a mall-based chain in the 1990s and courted young shoppers. But the rise of online shopping and the decline of malls have taken their toll.

“I was always overwhelmed by the number of options they had, you could spend hours in there,” Sherwood said. “It’s not going to be super fun knowing they won’t be around anymore.”

Shwanika Narayan is a San Francisco Chronicle staff writer. Email: shwanika.narayan@sfchronicle.com Twitter: @shwanika