The salary you need to buy a home in the 15 most expensive U.S. housing markets

You'd need to make six times the median household income to afford a median-priced home in San Jose, California.

The salary you need to buy a home in the 15 most expensive U.S. housing markets

Homeownership in the largest U.S. cities has been put further out of reach for all but the richest residents, according to a recent analysis by mortgage analytics firm HSH.

A household needs to earn $463,887 to afford a median-priced home in San Jose, California, making it the most expensive of the 50 largest U.S. cities. The estimate assumes no more than 28% of gross income spent on housing costs and a down payment of 20%, plus an average mortgage rate of 7.16% for borrowers with a good or excellent credit score.

Across all of the largest 50 U.S. cities, the income needed to cover the mortgage principal, interest, property taxes and homeowners insurance payments is an average of $104,339, which is well above the national household median of $74,580, per U.S Census data.

DON'T MISS: Achieve Financial Wellness: Be Happier, Wealthier & More Financially Secure 

Unsurprisingly, incomes needed to buy a home are highest in the largest American cities, where demand for homes is strong due to job opportunities, especially in the well-paid fields of tech, finance and health care.

A longstanding shortage of homes is another factor that's particularly acute in California, which helps explain why median home prices in some of the state's cities, such as San Jose, are twice the national median of $412,300, per U.S. Census data.

Here's a look at the 15 most expensive cities to afford a home, based on the income needed to buy a median-priced property in that market.

1. San Jose

Income needed: $463,887 Median home price: $1.84 million 

2. San Francisco

Income needed: $336,170Median home price: $1.3 million 

3. San Diego

Income needed: $241,784 Median home price: $981,000 

4. Los Angeles

Income needed: $207,030Median home price: $823,000 

5. Seattle

Income needed: $191,332Median home price: $755,300 

6. New York City

Income needed: $186,123Median home price: $659,200 

7. Boston

Income needed: $186,059Median home price: $704,700 

8. Denver

Income needed: $160,874Median home price: $651,000 

9. Miami

Income needed: $159,528Median home price: $625,000 

10. Washington, D.C.

Income needed: $155,370Median home price: $600,200 

11. Riverside/San Bernardino, California

Income needed: $146,792Median home price: $579,900 

12. Portland, Oregon

Income needed: $146,483Median home price: $574,000 

13. Sacramento, California

Income needed: $139,283Median home price: $533,900 

14. Austin, Texas

Income needed: $135,333Median home price: $466,700 

15. Salt Lake City

Income needed: $134,692Median home price: $551,200 

Data for this study was compiled using median home prices from the National Association of Realtors and 30-year fixed mortgage rates from Freddie Mac for the first quarter of 2024.

Mortgage rates for San Jose and San Francisco were 7.16% since median home prices in those cities qualify as jumbo-sized loans. Calculations for all other cities used mortgage rates of 6.75%. Data for jumbo loans — typically over $700,000 in most markets — was sourced from the Mortgage Bankers Association.

Property taxes were calculated using U.S. Census data for each city, while insurance costs are based on average rates for each state, using data from the Insurance Information Institute.

Want to stop worrying about money? Sign up for CNBC's new online course Achieve Financial Wellness: Be Happier, Wealthier & More Financially Secure. We'll teach you the psychology of money, how to manage your stress and create healthy habits, and simple ways to boost your savings, get out of debt and invest for the future. Start today and use code EARLYBIRD for an introductory discount of 30% off through September 2, 2024.

Plus, sign up for CNBC Make It's newsletter to get tips and tricks for success at work, with money and in life.

Kevin Levu in his Brookings, Oregon, home.