No matter what the temperature is outside, it’s rarely what we want it to be: Nearly a tenth of the entire planet’s energy consumption goes toward heating and cooling.

With the planet getting warmer and the population increasing, our global energy bill only figures to get bigger between now and 2050, but how we build our cities now could help decide by how much. According to a new study, the key is to make sure the world’s cities remain tightly packed. A denser city is a more energy-efficient city, and that could be a big help in dealing with climate change.

While big, densely populated cities like New York or Shanghai seem like energy-guzzlers, keeping millions of people in close quarters has advantages. It’s cheaper and easier to control the temperature of a small room than a large room, as any New Yorker can tell you. And a bunch of apartments packed together with lots of shared walls will also leak less heat than freestanding houses. Densely populated neighborhood can use shared heating and cooling systems that aren’t possible in more sparsely populated places.

“In general, highly dense cities like NYC and Chicago are more energy efficient, but the density doesn’t even need to be as high as in those cities,” Yale University researcher and study co-author Karen Seto told Vocativ in an email.

More Bamboo Cities Could Be The Future Of Urban Architecture

In other words, skyscrapers aren’t necessary for energy-saving density. A more European-style metropolis, where buildings generally aren’t higher than five to seven stories tall, has some advantages too. It doesn’t have high buildings that block the sun and disrupt air flow, meaning more energy has to be spent on lighting and air ventilation. These dense, taller cities also tend to trap heat, in what is known as the “urban heat island” effect, but shorter buildings avoid some of those problems. “Urban design, street design, and urban vegetation can offset some of the urban heat island.” said Seto.

Any kind of dense city, whether high rise or low rise, is preferable to endless suburban sprawl, where cars guzzle fuel to get people to work.

The key, according to the researchers, is to design and build up cities — particularly in countries like China’s booming cities — with long-term energy savings in mind. That could mean, for instance, strategically waiting for advanced energy saving technology to make upgrades to buildings. Another consideration, Seto said, is building cities so people can live closer to where they work. And then everyone wins: No one will complain about a shorter commute.