Affording a home is getting more difficult these days.
According to the National Association of Home Builders/Wells Fargo Housing Opportunity Index (HOI), nearly 62% of all homes sold nationwide last quarter could be afforded by a family earning the national median income. Two years ago -- when affordability peaked -- 78% of people could afford homes.
While mortgage rates are near record lows, home prices are on the rise -- and incomes aren't keeping up.
Of course, where you buy makes all the difference.
Related: Best cities for Millennial homebuyers
Short on cash? Steer clear of California, especially the Bay Area where tech money has sent home prices skyrocketing.
In San Francisco, the median home price is $875,000, making it the least affordable major U.S. city. Only 11.4% of homes sold in San Francisco during the third quarter were reasonably priced enough for the average family to buy, the index found.
Other major cities where home prices were out of reach included Los Angeles, Santa Ana, Calif., San Jose and New York.
Where home prices were most affordable was predominantly in cities that were hard hit during the recession.
Related: Mansions for under a million
In Youngstown, Ohio, for example, nearly 90% of all homes sold last quarter could be comfortably purchased by families earning the local median wage.
Syracuse, N.Y., Indianapolis, Ind., Harrisburg, Pa., and Dayton, Ohio, all recorded affordability rates of 84.9% or higher.
Despite the growing affordability gap, most buyers are still in a favorable position, said David Crowe, NAHB's chief economist. "Even with nationwide home prices reaching their highest level since the end of 2007, affordability still remains fairly high by historical standards," he said.
Related: Most Stressed Out Cities
Rose Quint, a vice president for survey research with NAHB, said conditions should remain favorable through at least next year. She believes home prices growth should slow while an improving economy should help people find jobs and boost their incomes.
One headwind could be rising mortgage rates, which could climb in the next year or so, said Tom Wind, executive vice president of home lending for EverBank.