The rusting of iron is an electrochemical process that begins with the transfer of electrons from iron to oxygen. The iron is the reducing agent (gives up electrons) while the oxygen is the oxidizing agent (gains electrons). The rate of corrosion is affected by water and accelerated by electrolytes, as illustrated by the effects of road salt on the corrosion of automobiles. The key reaction is the reduction of oxygen:
:O + 4  + 2  → 4 
Because it forms hydroxide ions, this process is strongly affected by the presence of acid. Likewise, the corrosion of most metals by oxygen is accelerated at low pH. Providing the electrons for the above reaction is the oxidation of iron that may be described as follows:
:Fe → Fe + 2 
The following redox reaction also occurs in the presence of water and is crucial to the formation of rust:
:4 Fe + O → 4 Fe + 2 O
In addition, the following multistep acid–base reactions affect the course of rust formation:
:Fe + 2 HO ⇌ Fe(OH) + 2 
:Fe + 3 HO ⇌ Fe(OH) + 3 
as do the following dehydration equilibria:
:Fe(OH) ⇌ FeO + 
:Fe(OH) ⇌ FeO(OH) + 
:2 FeO(OH) ⇌ FeO + 
From the above equations, it is also seen that the corrosion products are dictated by the availability of water and oxygen. With limited dissolved oxygen, iron(II)-containing materials are favoured, including FeO and black lodestone or magnetite (FeO). High oxygen concentrations favour ferric materials with the nominal formulae Fe(OH)O. The nature of rust changes with time, reflecting the slow rates of the reactions of solids.
Furthermore, these complex processes are affected by the presence of other ions, such as Ca, which serve as electrolytes which accelerate rust formation, or combine with the hydroxides and oxides of iron to precipitate a variety of Ca, Fe, O, OH species.
The onset of rusting can also be detected in the laboratory with the use of ferroxyl indicator solution. The solution detects both Fe ions and hydroxyl ions. Formation of Fe ions and hydroxyl ions are indicated by blue and pink patches respectively.