The permanent hardness of water is determined by the water's concentration of  cations with charges greater than or equal to 2+. Usually, the cations have a charge of 2+, i.e., they are divalent. Common cations found in hard water include Ca and Mg, which frequently enter water supplies by leaching from minerals within aquifers. Common calcium-containing minerals are calcite and gypsum. A common magnesium mineral is dolomite (which also contains calcium). Rainwater and distilled water are soft, because they contain few of these ions.
The following equilibrium reaction describes the dissolving and formation of calcium carbonate and calcium bicarbonate (on the right):
:CaCO (s) + CO (aq) + HO (l)  Ca (aq) + 2  (aq)
The reaction can go in either direction. Rain containing dissolved carbon dioxide can react with calcium carbonate and carry calcium ions away with it. The calcium carbonate may be re-deposited as calcite as the carbon dioxide is lost to the atmosphere, sometimes forming stalactites and stalagmites.
Calcium and magnesium ions can sometimes be removed by water softeners.
Permanent hardness (mineral content) is generally difficult to remove by boiling. If this occurs, it is usually caused by the presence of calcium sulfate/calcium chloride and/or magnesium sulfate/magnesium chloride in the water, which do not precipitate out as the temperature increases. Ions causing the permanent hardness of water can be removed using a water softener, or ion-exchange column.