Sure, there may be things about having a roommate that can get on your nerves — dealing with dirty dishes in the sink or someone else’s hair in the bathroom. But the financial benefits of having a roommate can outweigh all of the negatives, especially if you’re a millennial living in a big city.

The average renter living in a major city can save about 13 percent of his or her paycheck by making the switch from living solo to having a roommate, according to a new study from real estate site Trulia.

Those savings can make a huge difference for millennials, who are likely to spend a big chunk of their pay on housing if they are living alone. In nearly half of the 25 cities Trulia looked at, a millennial living alone in a one-bedroom apartment would need to spend more than 30 percent of his or her income on rent — surpassing the threshold for what financial experts say is affordable.

Take Miami, where renting a one-bedroom apartment at the median rent amount can take up 54 percent of the typical millennial’s income, which is a median of $40,000 there. By moving to a comparable two-bedroom apartment and splitting the rent with a roommate, that person can save $640 a month, or about 19 percent of his paycheck, the study said.

In New York, renting a median-priced one-bedroom apartment can take up nearly 34 percent of a millennial’s income. But moving to an apartment with a roommate can save a person $728 a month, or nearly 14 percent of the typical millennial’s income, which is $64,000 there.

Even in Minneapolis, where moving would make the least difference, millennials would save 6 percent of pay by gaining a roommate.

Here are the cities where millennials can save the biggest share of their pay by moving from a one-bedroom apartment to a two-bedroom place with a roommate:

Moving in with family or finding someone to split the rent with was the norm after the financial crisis, when many young people struggled to find jobs. But the habit has stuck. About 60 percent of millennials lived with roommates, their parents or other relatives in 2015, the highest rate in 115 years, according to an analysis of Census data by Trulia.

The economy has improved in recent years, which may tempt some people to ditch their roommates. But with rent prices and home prices still high, millennials hoping to one day buy a home can probably agree that every dollar counts.

Read more: