Here's an interesting thought exercise: if all the people in the world were crammed into one city, how much space would we take up? It's a question RealLifeLore tackles in depth in the video above.

The answer depends on just how tightly you want to pack people together – standing room only or space for a garden and pets? RealLifeLore looks at real-world examples of densely populated cities to give you some idea of the various permutations.

Take Singapore, currently the most densely populated country in the world, where an average of 7,605 people live in every square kilometre. If you can cope with that level of intimacy with your neighbour, we can fit all 7.4 billion of us into a city the size of Texas, Oklahoma, and Louisiana added together (just over a million square kilometres in total).

city-02The size of our world city, based on different population densities. Credit: RealLifeLore

There are areas of the world even more densely populated, however. Downtown Manhattan crams 26,939 people into every square kilometre on average, and if we were to adopt that template, we could all squeeze into a city the same size as the country of Ecuador – that's 283,560 square kilometres or almost 5,000 Manhattans.

For real-world population density, however, nothing comes close to the now demolished Kowloon Walled City in Hong Kong (where the header image for this article comes from).

Before it was knocked down in 1987, Kowloon was home to 33,000 people living in just 0.26 square kilometres (about three football fields).

If you're prepared to put up with that much of a crush – less than a square metre each, without roads or infrastructure or the help of multi-storey buildings – then everyone on the planet could fit in a city the size of Palestine, around 6,220 square kilometres.

As Kowloon Walled City shows, it's also a question of how high you want your residential buildings to go…

It might seem a largely pointless exercise to imagine a single city for the world, but with the very real threat of climate change to consider, in the coming years we might not have as many habitable places left on Earth as we're used to.

According to the UN, there could be more than 11 billion people on the planet by the end of this century. Not only would that mean we'd have to expand our world city borders to cope, it would also put extra strain on the Earth's resources – and just consider the additional impact another four billion people might have.

In a 2010 study published in PNAS, researchers from the Australian National University argue that eventually up to half the planet could become uninhabitable thanks to temperature rises over the next couple of centuries.

Another study published last year in Nature Climate Change predicted severe heat waves could strike areas of the Arabian Gulf and make cities such as Doha, Abu Dhabi, and Bandar Abbas uninhabitable in the next hundred years.

With those factors to consider, we might have to get used to fitting more people into smaller areas in the years to come.

Let's hope we're colonising Mars before we all have to fit inside a city the size of Palestine – but if the worst should happen, now you know what to expect.