This is the most expensive ZIP code in California—and it's not in San Francisco or LA

The income you need to afford a home in the biggest U.S. cities

It's no secret that living in California can be expensive. The median price of a home there is $537,315, compared to a national median of $268,500. But in the most expensive ZIP code in the Golden State, prices can reach more than 10 times that amount.

That's according to financial website GOBankingRates, which collected median home values and mortgage data from Zillow, as well as Bureau of Labor Statistics-based cost of living data for 48 states and the District of Columbia, in order to identify the nation's most expensive ZIP codes.

And, according to the findings, the most expensive ZIP code in California may not be where you think.

While places like San Francisco and San Jose tout median home values of above $1,000,000, the state's most expensive ZIP is actually 94027, or Atherton, where the typical home could cost you about $7 million.

How much more it costs to own vs. rent in your state

"Leave it to the Bay Area to host the most expensive ZIP code in the United States," says GOBankingRates. "Living expenses, such as the cost of groceries and health care, are above-average, but it's the cost of housing that raises the bar."

To calculate exactly how much you'd need to earn to live there comfortably, GOBankingRates used the 50-30-20 budget rule: 50 percent of your income would be used to cover necessities, 30 percent is discretionary income and 20 percent is allocated to savings.

"Monthly costs were totaled and multiplied by 12 to get the annual dollar cost of necessities in each ZIP code," writes GOBankingRates. "This dollar amount for necessities was then doubled to find the actual annual income needed to live in the location."

Zillow Home Value Index for 94027. Data through Mar 31, 2018.

Based on that data, here's how much it costs to live comfortably in 94027:

  • Necessities: $334,039
  • Splurges: $200,423
  • Savings: $133,616
  • Total income needed: $668,078

With a typical home bordering on $7 million, mortgage payments average $26,000 a month or more than $310,000 a year.

And prices continue to rise. Home values in Atherton have gone up more than 17 percent over the past year, Zillow notes, and are expected to rise 8 percent more within the next year.

If you're looking for a home, experts suggest making sure you're ready to transition from renting. Here are some tips to help you get started.

Like this story? Like CNBC Make It on Facebook!

Don't miss: Here's how much it costs to live in the most expensive ZIP code in New York

Video by Andrea Kramar

Location alone won't determine if your home is a great investment, but this will