For a brief period in 1998, it was cheaper to buy gasoline in the US than it was to buy bottled water or a Coke. The absurd situation came about because crude oil prices had fallen to their lowest since the 1950s—while the government kept paying large subsidies to oil companies.

Though the price of fuel isn’t as distorted today as it was then, globally we still pay hundreds of billions to subsidize fossil fuel use. The good news is that since 2012 we’ve been paying less and less each year, according to the International Energy Agency (IEA).

Subsidies, by definition, distort the market. They use taxpayers’ money to push a certain product or service that would otherwise not have succeeded on pure market forces. Whether they are good or bad depends on the situation.

For instance, the wind and solar boom would not have come about without subsidies. When they began, both sources of energy weren’t competitive with fossil fuels. But subsidies helped the renewable energy industry grow, which supported technology development and, in turn, led to price reductions. Renewable energy sources should soon become competitive without the need for subsidies, according to a 2016 report by the World Economic Forum. The same mechanics were at play in the shale gas boom of the last decade in the US and the liquefied natural gas boom of the 1970s in Japan.

Can’t escape the bean counters

Though conceptually simple to understand, subsidies are notoriously hard to calculate. The data are scant, often because governments try to hide them. So the IEA uses a different strategy. It calculates, say, what the price of gasoline (aka petrol) should be in India based on the global price of crude oil, along with local production and distribution costs. Then, if the actual price of gasoline is lower than the predicted price, the difference shows how much India is subsidizing that fossil fuel.

One reason for the sharp fall in global subsidies is the recent drastic fall in oil prices. Since 2014, crude oil prices have plummeted, so the price for consumer gasoline could remain low without subsidies.

Another reason is the sustained policy shifts across the world to cut subsidies, according to IEA’s Toshiyuki Shirai. Governments are looking to cut their countries’ emissions, and have realized that the financial benefits of subsidies for fossil fuels outweigh the environmental harm they support. Without the policy shifts, the IEA estimates that fossil-fuel subsidies in 2014 would have been $610 billion instead of $493 billion.

The 2015 IEA data show there are some 40 countries responsible for most of the subsidies given to fossil-fuel companies. It’s no surprise that the largest portion of those subsidies come from oil states like Russia, Saudi Arabia, and Iran. The other big contributors are large developing economies like India, China, and Indonesia, which see the subsidies as a means of making life easier for their poorest citizens (though the data show direct cash payments lead to better outcomes with the same amount of money).

There are two ways to subsidize fossil fuels. One is at the consumption end, where the government is simply paying a cut of the final price of the fuel. The other is at the production end, where the government is bearing some of the cost of production and thus lowering the final price of the fuel. The IEA only tracks consumption subsidies, because they are easier to estimate.

A group of countries that don’t feature in IEA’s list of 40 countries are the rich and developed economies, such as the US and Germany. These countries tend not to have any subsidies at the consumption end, said Shirai. Instead, they support fossil-fuel companies in a small way at the production end. For instance, Germany has, on average, given its coal industry more than $3.5 billion in production subsidies a year for the last 10 years. In 2014 alone, the US provided more than $21 billion in production subsidies for oil exploration.

No more hiding

In 2015, the International Monetary Fund (IMF) tried to give a fuller picture of fossil-fuel subsidies by estimating all forms, including production-side subsidies, as well as the “hidden” costs like those from global warming, air pollution, congestion, and traffic accidents. The IMF’s final number came to a whopping $5.3 trillion worth of fossil-fuel subsidies (about 6.5% of global GDP).

The IMF estimate should be taken with a grain of salt, because these hidden costs are prone to large estimation errors. In addition, though hidden costs are real, they don’t feature in economic measures and thus perhaps give us a false estimate of the benefits and harms of fossil fuels.

Nevertheless, it’s a useful estimate to understand the upper bound at which governments around the world might be supporting fossil-fuel companies.

The good news is that we’re moving in the right direction to cut fossil-fuel subsidies. A small amount may be necessary in specific situations, but largely these subsidies are distorting the market and stalling progress to cut emissions and fight global warming. The taxpayers’ money saved could be put towards other initiatives that will accelerate us towards a low-carbon future.