Many or all of the products featured here are from our partners who compensate us. This may influence which products we write about and where and how the product appears on a page. However, this does not influence our evaluations. Our opinions are our own.

Americans have always been really into their food, but in recent years, many have gotten more particular about their palate. Hence, the foodie.

These discerning diners are more likely to go for 100% grass-fed beef than a McDonald’s burger, and they’ll choose locally owned and locally sourced eateries over chain restaurants.

The desires and dining dollars of these epicures have helped take the culinary scene up a notch in many cities. And that means more great food for everyone, especially for those in San Francisco and Portland, which top NerdWallet’s list of the Best Cities for Foodies.

NerdWallet’s analysis

We looked at 50 U.S. cities with populations of at least 300,000 people and took into account the concentration of restaurants, breweries and farmers markets. The ratio of full-service to fast-food restaurants and the cost of dining in each city were also factored into the equation. Our analysis is strictly data-driven, so it doesn’t account for personal taste.

The overall score for each city was calculated using the following measures:

The number of restaurants per 100,000 residents in the metro area is 30% of the score. Data are from the U.S. Census Bureau’s County Business Patterns. The ratio of full-service restaurants to fast-food restaurants is 30% of the score. Data are from the USDA Food Environment Atlas. Number of breweries per 100,000 residents is 15% of the score. Data are from the Brewery Collectibles Club of America. The number of farmers markets per 100,000 residents in the county for each city is 15% of the score. Data are from the USDA Food Environment Atlas. Cost of a three-course meal for two at a midrange restaurant is 10% of the score. Data are from Numbeo.

Key takeaways

The coasts reign supreme. Seven of the 10 best cities for food lovers are located on or near one of the nation’s coasts, leaving the heartland largely unrepresented, but not far behind. In the Midwest, Minneapolis, St. Louis and Omaha all landed in the top 15.

Good food follows a good economy. The appearance of Anchorage, Alaska, on the list may surprise some foodies, but the culinary scene has improved in recent years alongside a strong economy.

Best cities for foodies

1. San Francisco, California

You don’t need to look hard to find a great restaurant in San Francisco. The city, along with nearby Oakland, has more restaurants for every 100,000 residents than any other city on the list. San Francisco also boasts 40 Michelin starred restaurants in and near the city, including four that earned the coveted three-star rating in 2015. Foodies pay a price for fine dining in San Francisco, though. The average price for two people to enjoy a three-course meal is $80, compared with a median price of $50 for other cities in this study.

2. Portland, Oregon

Portland is known as a beer town, and it’s no surprise: The city is home to 53 breweries, more than any other city in this study. Foodies with a taste for hops can grab a pint at Deschutes or Ecliptic Brewing, but don’t forget to eat. With almost 253 restaurants per 100,000 residents, Portland has a higher concentration of eateries than New York City, but with a more affordable price tag. The average price for two people to enjoy a three-course meal here is just $45. Several local dining spots have earned national accolades, including Ox, a restaurant inspired by the food of Argentina. The chefs and owners of this local favorite landed on Food & Wine’s Best New Chefs list in 2014, and were finalists for “Best Chef Northwest” in the 2015 James Beard Awards.

3. Seattle, Washington

The food scene in Seattle often falls under the radar, which makes it a perfect destination for aficionados who prefer the city’s low-key, Pacific Northwest vibe. Seattle has roughly 251 restaurants per 100,000 residents, including Cafe Campagne, a local favorite near the tourist-filled Pike Place Market, and Brimmer & Heeltap, which was voted best new restaurant in Seattle magazine’s 2014 readers poll. The Emerald City has plenty of beer to go with its great food, with 50 breweries in the city.

4. New Orleans, Louisiana

Beignets. Po’boys. Crawfish etouffee. Jambalaya. Oysters. There’s a lot for foodies to love about New Orleans, including a reasonable cost to dine. The average cost of a three-course meal for two in the Big Easy is $53, well below other big-name food cities such as San Francisco, New York City and Washington, D.C. Unsure where to start your New Orleans food pilgrimage? Try the grilled oysters at Drago’s, the alligator sausage and shrimp cheesecake at Jacques-Imo’s or anything on The Times-Picayune’s 50 Sips and Bites list.

5. Oakland, California

Oakland, along with its neighbor across the bay, has more restaurants per capita than any other city on this list. Two jewels in the city’s crown: Camino, a rustic eatery with a kitchen centered around a massive wood-fired oven, and Hopscotch, a riff on a diner that serves American food with Japanese influences. Both restaurants were featured in the San Francisco Chronicle’s annual Top 100 Bay Area Restaurants guide.

6. Denver, Colorado

Denver is a leader on the brewery and restaurant front. The Mile High City ranks second for the number of breweries for every 100,000 residents (7.85) and No. 11 for restaurants (222.73 per 100,000 residents). Chefs at three restaurants — Acorn, Fruition Restaurant and Work and Class — were named semifinalists in the James Beard Award’s Best Chef Southwest category for 2015. Diners looking for the best of both worlds will find thoughtfully crafted food and beer pairings at establishments such as The Kitchen Denver and Euclid Hall.

7. Boston, Massachusetts

Foodies who prefer to be in the kitchen, rather than in a restaurant, will find plenty of fresh produce in and around Beantown. Suffolk County, which encompasses Boston and three nearby cities, ranks fifth among the 50 places in this study, with 3.71 farmers markets for every 100,000 residents. The Copley Square Farmers Market, open Tuesdays and Fridays, is a favorite of locals and visitors alike.

8. Anchorage, Alaska

Outdoors enthusiasts who flock to Alaska’s biggest city will find a pleasant surprise: a great food scene. At 252.18 restaurants for every 100,000 residents, Anchorage has a higher concentration of eateries than Denver, Seattle, Pittsburgh and New York City. Moose’s Tooth is a local favorite for pizza, and Simon and Seafort’s Saloon & Grill, voted the best restaurant in several categories by readers of the Anchorage Press, serves fresh fish with a killer view on the side. The city’s restaurant boom has brought in a number of fast-food joints, but Anchorage County’s ratio of 1.1 full-service restaurant for every fast-food place is above average.

9. Pittsburgh, Pennsylvania

Pittsburgh’s restaurant scene is booming, bringing along innovative cuisine to complement some of the city’s mainstays. Pierogies Plus, located in a revamped gas station in McKees Rocks, is a local favorite. And other restaurants including Butcher and the Rye, Cure, Gaucho and Point Brugge will satisfy foodies’ appetites. Diners in Pittsburgh likely won’t feel a sting when the bill arrives, either. The average price for a three-course dinner for two is $48. The only top 10 city that’s more affordable is Portland.

10. New York City, New York

In 2015, the Big Apple was home to 73 Michelin starred restaurants, including six eateries with the coveted three-star rating. Top-tier cuisine comes at a cost in this city: A three-course meal for two averages $75, making it one of the most expensive cities. A good foodie knows how to find a bargain, though, and with almost 50,000 restaurants in the New York City metro area, there are plenty to be found. Khao Kang, a no-frills Thai restaurant in Queens; Carnitas El Atoradero, a Mexican joint in the Bronx; and Chayhana Salom, an Uzbek restaurant in Brooklyn, are a few favorites of Ligaya Mishan, who pens the Hungry City column for the New York Times.

NerdWallet staff writer Kelsey Sheehy contributed to this article.

San Francisco, California, restaurant image via iStock.