A recent survey by Bloomberg New Energy Finance expects solar energy to outrun coal and natural gas with lower costs much sooner than previously forecasted. Within a few years, renewables will be cheaper than coal almost everywhere in the world, according to the research group.

The study concluded that in the U.S. and Germany, solar already rivals the cost of new coal power plants, and is expected to do the same in high-growth markets such as China and India by 2021.

The cost of electricity from solar energy, or photovoltaic panels has fallen nearly 25% since 2009, and is expected to to decline another 66% by 2040. Onshore wind, after experiencing a 30% reduction in price over the same period, is forecast to slash costs another 47% in just over two decades. (See also: 2017: A Turning Point for the Solar Industry.)

Renewable Energy Prices Are Falling

If the projections turn out correct, total global carbon dioxide pollution from fossil fuels may actually begin to decline after 2026. By contrast, the International Energy Agency’s central forecast sees emissions continuing to grow for decades to come. “Costs of new energy technologies are falling in a way that it’s more a matter of when than if,” said BNEF researcher Seb Henbest, the lead author of the report.

Total coal-powered generation in the United States is estimated to be slashed in half by 2040, compared to an 87% drop in Europe, where environmental laws have increased the price of using fossil fuels. A whopping 369 gigawatts of coal projects stand to be canceled, amounting to the entire electricity output of Germany and Brazil combined.

Despite President Donald Trump’s decision to pull out of the Paris Agreement on climate change and his stated commitment to bringing back the U.S. coal industry, BNEF expects the world’s hunger for coal to subside in less than 20 years as governments work together to reduce emissions. “Beyond the term of a president, Donald Trump can’t change the structure of the global energy sector single-handedly,” wrote Henbest.

Wind and solar are expected to make up nearly half of the world’s total installed generation capacity by 2040, compared to just 12% now. (See also: Oil Giant Total Sees Bright Future in Electricity.)

Want to learn how to invest?

Get a free 10 week email series that will teach you how to start investing.

Delivered twice a week, straight to your inbox.