A recent study by GoBankingRates found that in 31 cities, residents can save hundreds of dollars a month by paying a mortgage instead of paying rent.

The study calculated the average cost of a mortgage in each city and compared it to the average rent in each city.

According to Zumper, in September 2019, the median national rent for a 1-bedroom was $1,250.

Visit Business Insider's homepage for more stories.

In some US cities, it's cheaper to own a home than to rent a place.

Rents across the country keep going up. According to Zumper, in September 2019, the median national rent for a 1-bedroom was $1,250.

A recent study by GoBankingRates, a personal finance platform, found that in 31 cities, residents can save hundreds of dollars a month by paying a mortgage instead of paying rent.

Read more: The 25 US cities where renters are becoming homeowners the quickest

The study calculated the average cost of a mortgage in each city and compared it to the average rent in the same city. To gather the average mortgage in each city, GoBankingRates factored in each city's median listing price, local property taxes, a 20% down payment, home insurance, and a 30-year fixed-rate loan, using data accurate as of July 10, 2019.

The study looked at the 85 largest US cities by population and found that, in 31 of them, the average monthly mortgage is cheaper than the average monthly rent — sometimes by hundreds of dollars.

Keep reading to see the full list, ranked from the city where buying saves you the least each month when compared with renting to where it saves you the most.