If you're having a hard time building a six-month emergency fund, you might want to rethink where you live.
A new study from personal finance website Bankrate took a look at the cities where it is most difficult or easy to stash away cash in case of an emergency.
Bankrate evaluated cities based on housing costs, such as mortgage, insurance and property taxes. It also included other expenses, such as groceries, health care, transportation and utilities.
Memphis came up on the top of the best cities list. The city's residents can save more on an annual basis than they need in their six-month emergency savings fund, according to Bankrate's calculations.
In other cities that rounded out the top five — Cincinnati, Cleveland, Pittsburgh and Detroit — it would take an estimated 13 months to build that six-month fund.
In the cities that fell to the bottom of the list, those emergency reserves are much farther out of reach.
In the New York area, for example it would take an estimated 521 months to achieve that savings goal.
And in other cities — San Diego, Los Angeles, San Francisco and San Jose — it would take an immeasurable amount of time to build up those reserves. That is because residents in those California cities are more likely to be in the red.
Regardless of where you live, you should not give up on reaching your savings goal.
"Set yourself up now for saving that is going to benefit you tomorrow and down the line," said Adrian Garcia, data analyst at Bankrate.
To do that, start by taking several steps.
To compile its ranking, Bankrate used data from sources including the U.S. Census Bureau, the Council for Community and Economic Research's Cost of Living Index and ATTOM Data Solutions.
More from Personal Finance:
Workplace perk can make it easier to save for emergencies
You're probably broke because you're not taking these savings steps
The latest victims of the student debt crisis — parents