According to a report by BBC News, Researchers at Reading University found that subtle changes occurred in metals as worms ingested and excreted soil.
These changes make it easier for plants to take up potentially toxic metals from contaminated land.
Earthworms are ideal "soil detectives", as their presence can act as a reliable indicator to the general health of the soil.
They have evolved a mechanism that allows them to survive in soils contaminated with toxic metals including arsenic, lead, copper and zinc.
"Earthworms produce metallothinein - a protein that is specifically designed to wrap around particular metals and keep them safe," explained Mark Hodson from the University of Reading.
"In broad terms, if an earthworm can cope with one type of metal, it can often cope with a suite of metals," he added.
A key piece of equipment in the study was the Diamond Light Source in Oxfordshire, the UK's newest synchrotron.
The X-ray technology there allowed scientists to examine metal samples that were, in Dr Hodson's words, "around 1,000 times smaller than a grain of salt".
They found that properties of metals in the material excreted from earthworms were slightly different from those found in the rest of the soil.
Some plants can pull out toxic metals from the soil, incorporate them into their tissues, and then be harvested and removed.
This whole process offers a sustainable and non-intrusive way to decontaminate land.
Earthworms make the metals more readily available to plants, speeding up the process and making it more efficient.
"The dream scenario is that the plants become so wonderfully efficient at extracting the metals that you can then take them off to a smelting plant," said Dr Hodson.