We often hear stories of an entire generation of Americans who may never be able to afford a home. In some of the country’s most expensive housing markets, such as San Francisco or Los Angeles, residents struggle to pay steep rents and often end up homeless because housing is so expensive.

Yet, in other parts of the country, homeowners pay just a small fraction of their income toward a mortgage.

Hire a Helper, a moving service provider, identified the most and least affordable metropolitan areas to buy a home, using data from Zillow to compare average mortgage payments to local household incomes.

The mortgage affordability index is a percentage of the monthly household income that goes toward a mortgage payment for a typical house in a given city.

Many of the least affordable metro areas were located in the western part of the country. In Boulder, Colo., the average single-family home is selling for more than $1 million, and the affordability index is nearly 28%, according to Hire a Helper. But in Peoria, Ill., mortgage payments consumed less than 9% of monthly household earnings.

Based on Hire a Helper’s report, these are the cities with most- and least-affordable mortgages, listed by large, medium, and small metropolitan areas.