For example, pipelines made out of steel suffer from corrosion if the metal is inhomogeneous in composition, e.g. at the welded joints. An electrochemical cell is formed with two different metals in electrical contact and an electrolyte solution: in the case of a pipeline, moisture and salts around the pipe act as the electrolyte. As a result of electrical current flow, the more electronegative metal will gradually be dissolved with the production of positive ions. Since this process is a fundamental property of the materials involved, it cannot be stopped very easily. However, it can be diverted, so that far less valuable metal objects are corroded instead. This is the sacrificail anode: the pipeline is electrically connected at intervals to buried plates of magnesium. Magnesium has a much more negative electrode potential than iron (-2.38V for Magnesium, versus -0.41V for iron: see Table of standard electrode potentials) and so will form the anode (negative electrode ) of the cell.
Now the electrochemical corrosion does not take place on the expensive steel pipeline but instead on the cheap magnesium plate, which is slowly transformed into magnesium ions.
Zinc and zinc alloys are often used for sacrificial anodes, for example in salt-water cooled marine engines and on yacht propellers. Galvanization (or galvanising) is the process of coating steel with zinc, which then forms both a protective layer and a sacrificial anode.
In order to retain their effectiveness, sacrificial anodes must be replaced at regular intervals as they are consumed.