In the long-brewing coffee wars between mom-and-pop shops and national chains, the battle lines have been fixed for years.

On one side sits Starbucks and Dunkin’ Donuts, their ubiqutous storefronts spread across seemingly every corner of the city. On the other, there are beloved neighborhood institutions like the East Village’s Abraço, South Slope’s Southside Coffee and Williamsburg’s Oslo Coffee Roasters.

The narrative is starting to shift, however. Starbucks and Dunkin’ Donuts have increased their footprints since 2013, when the city conducted an analysis of coffee and tea shops. But their share of the market has not changed dramatically since then.

The explosive demand for coffee and tea shops has helped smaller chains (often with local roots) rack up storefronts, according to Jonathan Bowles, head of the Center for an Urban Future, a think tank that tracks chain stores in the city.

“Starbucks really laid the groundwork and showed other chains that this is a successful model – that people would pay four or five bucks for a cup of coffee, and that they’d come back again and again,” said Bowles, who noted that his firm considers companies with at least two locations in the city and one outside of it a chain. “They’re not just a quaint little coffee shop with one location, which is great too, but I think that there’s also a difference between some of these local chains and a Starbucks.”

Dunkin’ Donuts has dominated the scene for years, accounting for nearly 27 percent of the 1,700 coffee and tea shops the city’s Economic Development Corporation tallied in a 2013 analysis of restaurant inspection data. At that time, 16 percent of the surveyed shops were Starbucks, and 57 percent were smaller chains or single-location businesses.

Today, Dunkin’ Donuts remains about 27 percent of the 2,052 coffee and tea shops culled from a similar analysis of the city’s restaurant inspection data. Starbucks represents 14 percent of the industry, and other smaller businesses made up the other 59 percent.

Because eateries can be inspected as seldom as once a year, looking at restaurant inspection data does not include all new coffee shops or exclude all shuttered locations. The methodology largely allows smaller companies to self-define as coffee or tea shops, sidestepping debates about exactly when a shop is more accurately called a bakery or a cafe.

The emerging snapshot of the industry shows how smaller chains are going the way of Dunkin’ Donuts and Starbucks.

Back in 2013, Blue Bottle Coffee had four locations in the city. Now it has nine, according to its website. During that time, Think Coffee grew from five outposts in the city to 10. Joe Coffee expanded from eight to at least 14 locations in the city. And Gregorys Coffee went from five to 23 New York City shops.

The industry’s growth is fueled, in part, by New Yorkers’ maturing palates, according to Gregorys Coffee founder Gregory Zamfotis.

“Even five years ago, people were kind of looking down their nose at people trying to charge any sort of premium for coffee,” he said. “Now it’s almost similar to like you see in craft beer or wine, where people are starting to get an appreciation for quality in the specialty, artisanal sort of beverage.”

Zamfotis said his company cannot woo in customers looking for one local coffee shop, where they know all four of the servers. But he said fewer and fewer of his competitors are catering to this clientele as well.

“Peers who had maybe one or two shops, they’ve all started expanding, too,” Zamfotis said.

Beyond expanding, some businesses like Proof Coffee Roasters and Fair Folks & A Goat offer memberhips, where customers get unlimited free or discounted drinks for a monthly fee.

When asked about its success, Dunkin’ Donuts issued a statement saying New Yorkers like its products. The company noted that its restaurants are owned and run by franchisees who are members of the local community.

A few dozen people rallied this month in front of a scaffold-covered corner of St. Marks Place and Avenue A, where a Starbucks is slated to open. They claimed the Seattle-based company and other incoming chain stores will disrupt the East Village’s culture and further erode its status as a hub of independent shops.

“It is a shame that it’s right on St. Marks, which used to be like the big middle finger to the whole capitalized, corporate world,” said James Armata, general manager nearby coffee shop of Mud, who has no qualms about growth among local competitors. “They have a different idea, a different vision. ... It’s not like a massive, homogenous, gray space that you can get anywhere – literally anywhere.”

Starbucks said in a statement that it was proud to bring a new store to what it called the Lower East Village, which it said would be designed to reflect the uniqueness of the neighborhood.

New Yorkers ordering coffee at Starbucks near Union Square said they thought chains succeeded because their many locations offer easy access and a standard menu.

“They offer a basic formula for people,” said Todd Burke, 52, a hotel concierge who lives in the East Village.

Alyssa Haddad, 26, of Astoria, said she thinks independent coffee stores are capitalizing on backlash against their chain counterparts.

But she noted that New Yorkers play a role in which model thrives.

“Couldn’t you just continue to go to your independent coffee shop and not support the Starbucks?”

With Alex Bazeley