Soap scum or lime soap is the white solid composed of calcium stearate, magnesium stearate, and similar alkaline earth metal derivatives of fatty acids. These materials result from the addition of soap and other anionic surfactants to hard water. Hard water contains calcium and magnesium ions, which react with the surfactant anion to give these metallic or lime soaps.
2 C17H35COO−Na+ + Ca2+ → (C17H35COO)2Ca + 2 Na+
In this reaction, the sodium cation in soap is replaced by calcium to form calcium stearate.
Lime soaps build deposits on fibres, washing machines, and sinks. Synthetic surfactants are less susceptible to the effects of hard water. Most detergents contain builders that prevent the formation of lime soaps.