What is Rust?
Rust is what commonly occurs when iron or steel is left out in the open in the presence of water or lots of moisture in the air. An electrochemical reaction occurs called oxidation, in which electrons transfer from the iron to the water.
This transfer of electrons creates hydroxide ions in the iron, turning the iron from a single element to a compound, called ferrous oxide, better known as rust. It's a loose, reddish-brown, flakey substance.
What Chemicals Do Onions Contain?
Onions have millions of tiny individual cells or containers within the latticework of their flesh. These contain enzymes called allianases.
Then these enzymes come into contact with oxygen or the open air, they break down into amino acid sulphoxides, creating sulphenic acids. This acid quickly becomes a vapor, which, when it contacts the moisture of the eye, condenses into a diluted form of sulphuric acid.
This is why people cry or their eyes sting when they are around chopped onions.
Why Do Onions Remove Rust?
Sulphenic acid, like all acids, reacts strongly with anything containing hydroxide ions. Rust happens to be such a substance, containing one hydroxide ion for every atom of iron in the compound.
When a cut onion is rubbed against something rusty, the sulphenic acid within the onion breaks down the rust, causing it to flake away, leaving behind any untouched layers of iron beneath the rust coating. This process also happens to neutralize the acid.
So if you're trying to remove rust from an item by this method, something with lots of rust may require more than one slice of onion.