In what U.S. cities can your paycheck go the furthest? When you factor in local living costs, adjusted salaries are highest in Birmingham, AL, Jackson, MS, and Fresno, CA. But beware: places where your salaries go furthest today are more at risk of losing jobs in the future.

When looking at jobs in different local markets, a dollar is not always a dollar—and sometimes it isn’t even a dollar. Paychecks go further where housing and other costs are lower. This is the dilemma job seekers face: The places with the highest salaries also have the highest cost of living.

Salaries are highest in San Jose and San Francisco, but that doesn’t take into account the cost of living. When you factor in how much more expensive it is to live in the Bay Area, the rankings flip entirely. It turns out that when salaries are adjusted for cost of living, they tend to be higher in smaller metros than in the largest ones. Adjusted salaries are highest in Birmingham, AL, Jackson, MS, and Fresno, CA—places where what you’re likely to earn buys the most. Big cities like Miami, New York and Los Angeles are among those where your salary won’t stretch far.

So should job seekers write off metros where salaries don’t keep up with the cost of living? Not necessarily. Some people want a huge city, despite the high costs. If that’s you, consider Detroit or Atlanta, and check out the list below. In fact, a low average adjusted salary just might be a signal that a city is special for reasons other than money. Plus, places that look like a worse deal today might offer greater job security tomorrow.

Living large in Birmingham, and just getting by in Honolulu

Big salaries and high prices go hand-in-hand. The five metros with the highest salaries—San Jose, San Francisco, Washington, DC, Fairfield County, CT, and New York—are among America’s most expensive places to live. That makes sense. If there were some magical place with fat paychecks and low prices, people would flock there—flooding the market with workers while bidding up the cost of housing—and the magic would fade.

But salaries and prices don’t all even out in the wash. To find where salaries go furthest, we calculated the average salary for all jobs with annual-salary information posted on Indeed between August 2016 and July 2017 in each of the 104 US metropolitan areas with at least 500,000 people, and then adjusted for each metro’s cost of living.

When we adjust for living costs, those big coastal metros with high average salaries no longer look like a good deal. Instead, as noted, the highest adjusted salaries are in Birmingham, AL, Jackson, MS, and Fresno, CA. Not a single big coastal metro ranks among the top 20, but plenty of smaller metros in the South and Midwest do. The only California metros among the top 20 are far from the Pacific—in the Central Valley metros of Fresno, Bakersfield, and Modesto, where housing is much cheaper than on the coast.

Where do salaries stretch the least? Poor Honolulu. Its salaries aren’t that high to begin with and, after adjusting for its high cost of living, it’s the most expensive metro in the country. Honolulu is expensive not just because of housing costs. Housing actually is more expensive in San Francisco and San Jose, but housing accounts for only one-third of the typical American’s total expenses. In Honolulu, physical goods cost more because they have to be shipped to the middle of the Pacific. Altogether, Honolulu’s adjusted salaries are the lowest in the country, more than $7,000 below the next lowest, Tucson, AZ—a bigger gap than the difference between top-ranked Birmingham and Baton Rouge, number 20.

After accounting for cost of living, some of the metros with the highest unadjusted salaries tumble into the bottom 20, including Washington, DC, and New York. Not San Jose and San Francisco though. Unadjusted salaries in these Bay Area metros are so high that, even after adjusting for local prices, they still rank in the middle of the pack, nowhere near the bottom 20.

Making ends meet in the big city

If you’re looking for a rule of thumb for where salaries go furthest, start with this: Adjusted salaries are higher outside the largest metros. Even though you’ll see more money on your paystubs in bigger metros than in smaller metros, those big-city salaries are outweighed by an even higher cost of living. Suppose though you’re one of those people who wants to live in a major metro despite the higher costs. Where’s the best deal?

Among the 15 largest metros, Detroit, Atlanta, and Dallas offer the highest salaries after adjusting for the cost of living. San Francisco ranks fourth and is the highest-ranked large coastal metro. Miami and New York bring up the rear, with Miami’s average salary 15% behind that of Detroit.

So why isn’t everyone moving from Miami to Detroit—or, for that matter, from Honolulu to Birmingham? For starters, many people are tied to where they live. They don’t want to move away from family or friends, or maybe they have a professional practice or family business that depends on local customers. Then too, some places are so appealing that people want to live there even it means taking a financial hit. No wonder that the three places with the lowest adjusted salaries—Honolulu, Tucson, Miami—are desirable places to be when work is done. Maybe beaches and sunshine can compensate for a salary that doesn’t go as far.

What’s more, adjusted salaries aren’t the only measure of local labor market strength. Salaries may go farther in Knoxville, TN, than in North Port-Sarasota-Bradenton, FL. But job growth is sluggish in Knoxville, while it is booming in the Florida metro. In addition, many occupations are clustered in particular places. If you’re in the movie industry, Los Angeles might be your best spot even though most other metros have higher adjusted salaries.

Finally, if you’re thinking not just about the present but also about the future, there might be job security reasons for staying in a place where adjusted salaries are relatively low. In metros where adjusted salaries are higher, a larger share of local jobs are what economists call “routine,” which means they are at greater risk of being automated and disappearing. That paycheck in Bakersfield, Scranton, and Chattanooga might go far today. But what if a robot does the job tomorrow? Today’s good deal might turn out to be a deal that’s too good to last.

Methodology

Salary data are from all job postings with annual salaries on Indeed between August 2016 and July 2017. Unadjusted average salaries are based on a fixed-effects regression model that accounts for the different mix of job titles across metros in order to make an apples-to-apples comparison of unadjusted salaries.

Local cost-of-living data are from the U.S. Bureau of Economic Analysis regional price parities for 2015 (released June 2017). These cost-of-living data reflect local differences in the price of housing, other services and physical goods.

All 104 U.S. metropolitan areas with at least 500,000 people were included in the research and rankings. The largest fifteen have 3.4 million people or more—Seattle and up. Fairfield County, CT, refers to the Bridgeport-Stamford-Norwalk metropolitan area.