×

Here's where you can't afford to buy a house

It's either a great time to buy a house—or you'll never be able to afford one.

A lot depends on where you live.

Home prices have perked up again after taking a breather last year. U.S. single-family home prices rose in December, especially in the western half of the country, according to the latest numbers from the widely watched S&P Case Shiller home price index.

And while the job market is also improving, those gains have yet to show up in workers' paychecks. On Friday, the government reported that U.S. employers added 295,000 jobs, pushing the jobless rate down to 5.5 percent from 5.7 percent.

Those new jobs will help bring more would-be home buyers back into the market. But when they go house hunting, some of them will find their wages don't go far enough to close the deal. Last month, the average hourly wage crept up just 3 cents to $24.78 an hour.

The average hourly wage has risen by just 2 percent over the past 12 months, barely edging out inflation. House prices, meanwhile, gained 4.5 percent in December over prior year, according to the S&P Case Shiller index.

Read More Why 5.5 percent unemployment isn't as great as it seems

Lower mortgage rates have kept homes affordable in many parts of the country. But the range of affordability is huge, according to an analysis of county-level home prices and incomes.

In Allegany, New York, Blackford, Indiana and Wayne, Michigan, the cost of buying a median-priced home will take up just 8 percent of the median household income, based on 2013 Census data and Zillow's Home Value Index. (We're assuming the buyer puts 20 percent down, gets a 30-year fixed rate mortgage at 3.8 percent, pays property taxes of 1.2 percent of the home's value and buys an annual home insurance premium of $3.50 per $1,000 of home value.)

On average, Zillow estimates that most home buyers should expect to spend about 15 percent of their incomes on mortgage payments for a typical home. (For first-time, 23-to-34-year-old buyers, Zillow figures they'll spend more like 17 percent of their monthly income.

That's a substantial bargain compared to renting. According to Zillow data, renters on average pay twice as much—about 30 percent of their median incomes.

The amount you can afford is really up to you; everyone's budget is different. But to get a loan, you'll need to fall within lender guidelines. Your total debt—your mortgage and other debt, like credit card balances or student loans—can't exceed a debt-to-income ratio set by the lender. In some cases that can be as low as 28 percent. For some FHA loans, lenders may go as high as 43 percent.

That won't be enough to buy a house in the priciest places in the country, such as Manhattan, where the median home price of $1.3 million would consume more than 100 percent of the median household income.

California, though, has the priciest counties. It's home to 13 of the 25 U.S. counties where the cost of buying median-priced home consumes more that 43 percent of median incomes: San Francisco (78 percent), San Mateo (62 percent), Marin (60 percent), Santa Cruz (58 percent), Santa Clara (56 percent), Los Angeles (53 percent), Alameda (52 percent), San Luis Obispo (52 percent), Santa Barbara (51 percent), Orange (49 percent), Mendocino (48 percent), Sonoma (47 percent) and San Diego (45 percent).