By creating a housing shortage, the coronavirus delivered a blow to housing affordability. However, in a countertrend that softened the blow to buyers’ budgets, the pandemic also drove mortgage rates to record lows.

Now, though, mortgage rates have risen, and home prices have soared at a record pace over the past year. The National Association of Home Builders estimates the median price of all new and existing homes sold in the U.S. rose to a record $390,000 in the second quarter of 2022.

As a result of skyrocketing prices and a spike in mortgage rates, Americans face an affordability squeeze. Just 42.8 percent of homes sold during the second quarter were affordable to families earning a typical income, down from 56.9 percent in the first quarter, the builders group says.

Before the recent housing boom, affordability conditions weren’t so daunting. The National Association of Home Builders/Wells Fargo Housing Opportunity Index affordability index number says fully 66 percent of homes were in reach of typical buyers in the first quarter of 2020, the onset of the pandemic.

3 factors drive affordability

The builders’ index looks at three variables: incomes, home prices and mortgage rates. The affordability study shows nationwide home prices remain high. The median home price posted yet another record in the first quarter.

In a trend that tightens the affordability squeeze, average mortgage rates rose to 5.33 percent in the second quarter, up from 3.86 percent in the first quarter and 3.16 percent in the fourth quarter of 2021.

While falling mortgage rates had created tailwinds for affordability, that trend has reversed. Meanwhile, wages are rising fast — median income jumped to $90,000 this year from $79,900 last year, according to the index, a 13 percent climb. However, home prices are rising faster than paychecks.

The pandemic has created another unintended consequence: Prices of building materials have soared.

“Rising housing costs stemming from increased interest rates, supply chain disruptions that have led to higher prices for building materials and a persistent lack of construction workers are dramatically affecting home prices,” National Association of Home Builders Chairman Jerry Konter said in a statement.

5 most affordable metro areas

Home prices and incomes vary widely, and there are oases of affordability, mainly in the Rust Belt and Midwest. The top five most affordable places among metro areas with a population of 500,000 or more:

Lansing, Michigan: As a result of modest home prices, 85.2 percent of all new and existing homes sold in the fall months were affordable to families earning the area’s median income of $89,500. The median home price was $160,000 in the second quarter of 2022, the builders’ index says.

Indianapolis: This metro area has a median family income of $94,100 and a median home price of $226,000. As a result, 83.2 percent of homes were affordable for typical earners.

Toledo, Ohio: With a median family income of $77,800 and a median home price of $145,000, fully 80.3 percent of homes were in reach of median-income families.

Harrisburg, Pennsylvania: This metro area has a median family income of $94,300 and a median home price of just $201,000. As a result, 79.9 percent of homes were affordable for typical earners.

Scranton-Wilkes Barre-Hazleton, Pennsylvania: Wages here are below national levels, but so are home prices — the median sale price was $159,000. As a result of rock-bottom prices, 79.4 percent of all new and existing homes sold the second quarter were affordable to families earning the area’s median income of $74,100.

5 least affordable areas

At the opposite end of the affordability spectrum, California dominates. The nation’s least-affordable markets:

Los Angeles-Long-Beach-Glendale: In a market with a median home price of $870,000, LA’s median income of just $90,100 doesn’t go far. As a result, only 3.6 percent of homes were affordable for typical families.

Anaheim-Santa Ana-Irvine: Orange County’s incomes are high: The typical family makes $120,200 this year. But home prices are higher, at a median of $1.05 million. That means just 5.6 percent of homes are in reach of average families.

San Diego-Carlsbad: San Diego has a median family income of $106,900 and a median home price of $835,000, translating to just 6.9 percent of homes falling in the typical buyer’s budget.

San Francisco-Redwood City-South San Francisco: Incomes are high here — the median is $163,800. Prices are even higher — the typical home went for $1.58 million. That translates to just 7.5 percent of homes sold during the winter months falling in the range of affordability for families earning the area’s median income.

San Jose, California: This area’s median family income is $168,500, highest in the nation, but the typical home sold for $1.5 million. That meant 11.1 percent of homes sold were affordable.

Housing affordability has been an ongoing challenge in California and other areas that have seen strong demand and little new building since the Great Recession.