If the holy grail of medieval alchemists was turning lead into gold, how much more magical would it be to draw gold from, well, poop? It turns out that a ton of sludge, the goo left behind when treating sewage, could contain several hundred dollars’ worth of metals—potentially enough to generate millions of dollars worth of gold, silver, and other minerals each year for a city of a million people.

Metals have long been known to concentrate in sewage, which mixes toilet water with effluent from industrial manufacturing, storm runoff, and anything else flushed down the drain. It’s a headache for sewage utilities that must cope with toxic metals lacing wastewater headed for streams or sludge that might otherwise be spread on farm fields.

But what if those metals had value? In a new study, scientists at Arizona State University (ASU), Tempe, quantified the different metals in sewage sludge and estimated what it all might be worth. They took sludge samples gathered from around the country and measured the metal content using a mass spectrometer that can discern different elements as they are ionized in a superhot plasma. The upshot: There's as much as $13 million worth of metals in the sludge produced every year by a million-person city, including $2.6 million in gold and silver, they report online this week in Environmental Science & Technology.

That amount won't be rattling the world gold market, nor would it be feasible to extract every last bit. But the study’s lead author, environmental engineer Paul Westerhoff, says it could prove worthwhile for cities looking for ways to gain value from something that can be a costly disposal problem. One city in Japan has already tried extracting gold from its sludge. In Suwa in Nagano Prefecture, a treatment plant near a large number of precision equipment manufacturers reportedly collected nearly 2 kilograms of gold in every metric ton of ash left from burning sludge, making it more gold-rich than the ore in many mines.

Although no U.S. sewage plants have followed suit, the new study adds to a growing push to rethink sewage as a valuable commodity, says Jordan Peccia, a Yale University engineer who was not involved in the work. Approximately 8 million tons of biosolids—a dried derivative of sludge—are generated every year in the United States.

Today, about 60% of the sewage sludge in the United States is already spread on fields and forests as fertilizer. But there are concerns it poses contamination risks from toxic chemicals and pathogens, a subject Peccia’s lab studies. The remaining sludge is burned in incinerators or dumped in landfills.

“We’re not going to get rid of this sewage sludge,” Peccia says. “We need to make this push where we stop thinking about it as a liability and instead we think about it as a resource. And anything we can find in sewage sludge that’s valuable, it’s good.”

Metals aren’t the only things with potential value. A small number of sewage plants are removing phosphorous and nitrogen, which can be sold as fertilizer. A Swedish treatment plant is testing the feasibility of making bioplastics from wastewater. A model sewage incinerator that generates electricity and drinking water was just promoted by the Bill & Melinda Gates Foundation, which helped fund its construction.

But it could be a while before wastewater operators start prospecting for precious metals in more than an isolated case. The minerals found in the sludge were frequently dissolved or in microscopic particles. Rare earth elements were so dilute that they were present in levels similar to those in plain dirt.

Precious metals such as gold could find their way into the sewers courtesy of mining, electroplating, electronics and jewelry manufacturing, or industrial and automotive catalysts. The sludge in the study came from two Arizona treatment plants and from a mixture of samples from around the country stored at ASU’s U.S. National Biosolids Repository.

Focusing on 13 of the most concentrated minerals with the highest value, the scientists put the haul at $280 per ton, or $8 million for that hypothetical million-person city. That included such precious metals as platinum, gold, and silver, as well as more common copper, iron, and zinc. A metric ton of sludge contained 16.7 grams of silver and about a third of a gram of gold. Even then, the practical value could be less, as the estimate was based on extracting every bit of the metals.

The study doesn’t spell out the potential cost of getting at these metals or the price society pays for leaving them in the sludge, such as added pollution. "The next thing is to look at whether it’s economically or technically viable,” Westerhoff says. “We think it is.”

Cost is one of the chief barriers keeping sewage treatment plants from going for the gold, says Charles Bott, chief of research and development at the Hampton Roads Sanitation District in Virginia Beach, which serves 1.7 million people in southeastern Virginia. The district started extracting phosphorous and nitrogen from sludge at one of its plants in 2010 to comply with stricter protections for Chesapeake Bay. Mining sludge is “a hot topic of conversation,” Bott says. “It’s just a question of getting to the point where the technology is available that makes the finances work out.”