Have you ever wondered how much income you would need to live in the  most expensive cities in the U.S.? Not just to survive, but to live a reasonably comfortable lifestyle? Fortunately, the folks at personal finance site GOBankingRates have done the math for you. They've just published their ranking of 50 major U.S. cities, from least expensive to live in to most expensive to live in, and they've figured out how much it costs per year to live comfortably in each.

How did they do the figuring? Simple--by following the longstanding budgeting formula that 50 percent of your income should go to necessities, 30 percent to things you want but don't strictly need, and 20 percent to savings. With that in mind, they've added up the cost of necessities in each of these cities, defining necessities as average rent of a one-bedroom apartment plus estimated costs for transportation, groceries, utilities, and health insurance. Taking those costs and doubling them, they arrived at the income needed to live comfortably in each of these cities. You can find the full list of 50 cities here. These are the 10 priciest.

1. San Francisco

$123,268? to live comfortably

It's no surprise that San Francisco tops the list of most expensive places to live. Residents have been lamenting the high cost of living for a long time, and yet the city's charm, Asian influence, and status as a hot high-tech locale packs a lot of appeal. On the other hand, the city has far and away the most expensive rent in the country, averaging $3,300 a month for a one-bedroom. Groceries are also more expensive than they are elsewhere.

According to GOBankingRates, San Franciscans have finally had enough. "The city is facing a mass exodus of residents," according to the site. It makes sense when you consider that even if they moved to the second-most expensive city in the U.S., they'd be likely save more than $20,000 a year.

2. New York

$99,667 to live comfortably

"If I can make it there, I'll make it anywhere," Frank Sinatra sang. Well, you can make it there if you earn $100,000 a year, but only just. At $2,295 a month for the average one-bedroom, New York has the third-highest rent in the country. It also has the second-biggest gap between residents' average earnings and cost of living. No wonder so many who work in New York City live just across the Hudson in New Jersey and commute in.

3. San Jose

$99,431 to live comfortably

Want to live in the heart of Silicon Valley? It'll cost you. Typical rent here is second only to San Francisco's, at $2,395 a month. On the other hand, living in startup heaven may pay off, because average income in this city is $90,303--the highest of all 50 cities. And then, of course, there are the stock options.

4. Oakland

$95,611 to live comfortably

Oakland has always been San Francisco's poorer neighbor, and it still is. It's where people who can't afford to live in San Francisco often live. Typical rents are more than $1,000 a month cheaper for a one-bedroom--$2,195 compared with $3,300 for San Francisco. That's still enough to be among the top five highest rents in the nation, though. And with an average income of $57,778, many Oakland residents are struggling to survive in their increasingly expensive town.

5. Washington, D.C.

$90,811 to live comfortably

Living near the center of power can be expensive--typical rents in D.C. are $2,170 a month, just a hair lower than in Oakland. At least residents' median income of $72,935 is among the top five in the nation. And transportation costs are lower here, although groceries are expensive. Civil servants don't usually earn all that much, though, which is why many of them live nearby in Virginia or Maryland.

6. Seattle

$89,248 to live comfortably

Rents in Seattle are rising rapidly, an unpleasant side effect of Amazon's continued growth, which is partly behind the rapid influx of new residents, especially Millennials. Still, at a typical $1,975, they're a lot lower than rents in San Francisco or New York, at least for the moment. Median income is $74,458, the fourth highest in the nation.

7. Boston 

$88,967 to live comfortably

Rent in Boston is $2,100, one of the highest in the nation. Transportation costs are a bit lower than average, though, perhaps thanks to a good public transportation system. (That has the added advantage that you don't have to drive around Boston, which is a good thing as you will inevitably get lost.) Unfortunately, median income in Boston is less than $60,000, which means a lot of people there are struggling to get by.

8. Los Angeles

$87,260 to live comfortably

In addition to having the allure of the movie industry, L.A. is becoming a startup hub, as the next major city down the coast from Seattle and San Francisco. Typical rent is $2,050--higher than in Seattle. And L.A. is consistently ranked as the city with the worst traffic in the United States.

9. Anaheim

$86,721 to live comfortably

You can live in the shadow of Disneyland's Sleeping Beauty Castle, but it'll cost you only slightly less than living in nearby L.A., with average rent at $1,912. Tourism is the dominant industry here, with Disneyland the city's largest employer, although YKK, the world's biggest zipper maker, is also located in Anaheim. 

10. Honolulu

$85,367 to live comfortably

The least expensive of the 10 costliest cities might also be the nicest place to live. It shows up regularly on ranks of most livable cities and has been ranked among the safest cities in the nation as well. Besides being the state's capital and biggest city, it's considered the gateway to Hawaii, a business, military, and cultural hub. It also has the third highest median income at $77,161. Although groceries and other goods are costlier, as things usually are on an island, rents are less expensive than in California.