Water becomes hard due to the presence of calcium and magnesium salts.
When sodium or potassium soaps are dissolved in water, the ions generate insoluble calcium and magnesium soaps. In water, the insoluble soap separates as scum, rendering it ineffective as a washing agent.
The term "hard water" refers to water with high mineral content.
Hard water is created when water percolates through calcareous, gypsum, or chalk deposits, which are generally made up of magnesium or calcium carbonates, bicarbonates, and sulfates.