Fertility rates are in free fall all over the world, portending an enormous change in societies for upcoming generations, researchers say. Nearly every country in the world is looking at a dwindling population and 23 nations — Japan and Spain among them — could see their populations cut in half by the end of this century.

The math is pretty simple. For any population to grow, women need to have a little over an average of two kids. In 1950, the average birthrate per woman was 4.7. By 2017, it was 2.4. Researchers estimate that by 2100, it’ll be at 1.7. As a result, the global population is still climbing at the moment, but it’s expected to peak in a few decades. By 2100, it’ll be back at a little under nine billion.

“That’s a pretty big thing; most of the world is transitioning into natural population decline,” researcher Professor Christopher Murray told the BBC. “I think it’s incredibly hard to think this through and recognize how big a thing this is; it’s extraordinary, we’ll have to reorganize societies.”

There’s no one reason why this is happening. Research suggests that much of the decline comes from increased education and professional opportunities for women, as well as expanding access to contraception. Other research points to the ballooning costs of childcare that makes parenthood less financially feasible for millennials than it did for their parents and grandparents.

This will have a lot of different impacts on the world — some of them bad, some pretty good. On the one hand, fewer people is better for the environment, leading to a reduction in carbon emissions and deforestation. But on the other hand, a population decrease means the average age of society goes up, and that leads to big questions about who will care for the elderly and how. This study projects that the number of 80-plus year-olds will explode from 141 million in 2017 to 866 million in 2100. That’s a lot of people to take care of, and it’s why experts predict that many countries will begin competing for immigrants.

Professor Ibrahim Abubakar of the University College London said: “If these predictions are even half accurate, migration will become a necessity for all nations and not an option. To be successful we need a fundamental rethink of global politics.”