Bathrooms and waste treatment plants are a few things you can forgive yourself for taking for granted. They are, after all, designed to make things we don’t want to see or smell disappear.

But for a moment, on this World Toilet Day — a day that highlights the fact that 2.4 billion people around the world don’t have access to sanitary bathrooms — consider the world-changing potential that comes with every flush. As efforts to improve sanitation conditions in the developing world help stop the spread of disease, new technologies are also putting the gross to good use.

Water, water everywhere

Climate change and growing populations are increasing water scarcity around the world, leading many cities to tap into what’s essentially an unlimited source of water right under everyone’s noses. What goes around is coming back around, as engineers develop means of recycling excrement to produce fresh, drinkable water.

Earlier this year, Bill Gates unveiled a machine capable of converting poop into H2O. The device works by boiling sewage, capturing the water vapor, and then further processing that water to render the final product drinkable. Gates demonstrated the machine by downing a glass of water that just minutes earlier had been human waste.

“The water tasted as good as any I’ve had out of a bottle,” Gates wrote in a blog post in January. “And having studied the engineering behind it, I would happily drink it every day. It’s that safe.”

Poop to Power

If left to fester, human waste can be a robust source of methane, an extremely potent greenhouse gas. When processed, however, sewage can be used to generate power. Methane is the active ingredient in natural gas. When burned it can generate power with a fraction of the CO2 emissions per kWh of coal. (That’s right. Even poop is cleaner than coal.)

Washington, D.C. stands at the leading edge of poop-power innovation. The city is using microbial bugs to turn human waste into methane before burning that methane to generate electricity. D.C. Water says its recently unveiled thermal hydrolysis system will shrink the carbon footprint of its treatment facility by a third. D.C. isn’t the only one to embrace poo as an energy source — the Birmingham area of England is also using the methane that comes from processed sewage to power homes.

Spread the Wealth

It used to be when you flushed the toilet you were saying goodbye to a rich source of nitrogen, phosphorous and other nutrients. But now roughly half of the human waste generated in the United States ends up as fertilizer. Human “biosolids” — the poop business is replete with euphemisms — are heated to eliminate all harmful bacteria. Recycling raw sewage can obviate the need for more expensive chemical fertilizers, turning a waste stream into an income stream. Some research has also found that biosolids, when applied to soil, can be effective at sequestering carbon.

However, the use of biosolids as fertilizer isn’t without its controversies — some groups worry that things like heavy metals, chemicals, and pharmaceuticals are retained in biosolids, making them less than ideal for use as fertilizers.

World Toilet Day was created in 2001 to raise awareness of more than two billion people worldwide who lack access to toilets. Today, global efforts to clean up unsanitary places are increasingly turning into win-win scenarios.

The problems of poop lie largely in our own imagination and our understandable disgust at the thought of transforming human waste into food and water. But, as we face a scarcity of clean power, drinkable water and arable land, it will become necessary to look to our toilets for a solution.

Jeremy Deaton writes for Nexus Media, a syndicated newswire covering climate, energy, policy, art and culture. You can follow him @deaton_jeremy.