Place of residence can make a difference when it comes to staying healthy, according to a new report by WalletHub.

The personal finance website looked at the 180 most populated cities in the U.S. and rated them by using 41 key indicators of good health, with the data ranging from the costs for medical visits to fruit and vegetable consumption.

"Some places promote wellness by expanding access to nutritious food and recreational facilities," WalletHub said in its report. "Others strive to keep healthcare costs affordable for everyone or keep parks clean and well-maintained."

In the final ranking, WalletHub scored cities in four general categories: healthcare, food, fitness and green space.

The analysis showed a wide divergence among cities in some categories, according to WalletHub. For example, when looking at mental health counselors per capita, the study found a 12-fold difference between the top city in the category, Spokane, Wash., and the worst, Portland, Maine.

"Where people live can have a big influence on how successful they are at staying in good health, so the best cities are the ones that provide the greatest access to high-quality healthcare, green spaces, recreation centers and healthy food,” WalletHub analyst Cassandra Happe said in the report.

The following cities, in ascending order, were ranked as the healthiest locations in the U.S.

10. Irvine, Calif.

The city ranks 10th for fitness and 12th for healthcare.

 

9. Scottsdale, Ariz.

This is the top-ranked city for fitness.

 

8. Salt Lake City

The city ranks third in the nation for green space.

 

7. Denver

The city ranks 11th for the quality of its food.

 

6. Portland, Ore.

The city ranks sixth for food and eighth for green space.

 

5. Washington, D.C.

The city ranks seventh for food and ninth for green space.

 

4. San Diego

The city ranks fifth for food and sixth for green space.

 

3. Seattle

The city ranks third for the percentage of adults who are physically active. It is also the fifth-best city in the nation for fitness.

 

2. Honolulu

This Hawaiian city ranks second for green space.

 

1. San Francisco

The city ranks second in the nation for residents' fruit and vegetable intake and third for healthy restaurants per capita. It also ranks first for food and green space.

The full report can be viewed here.