Hard water is treated by a process called softening, in which certain metal ions that are dissolved in the water are reduced, most frequently in home applications by the use of membranes in a process called reverse osmosis or ion exchange. Towns and cities may also soften water for their customers by a process called lime softening.
Water hardness is caused by particular metal ions, most often calcium and magnesium, being dissolved in the water. The ions cause the water to have unappealing properties, such as bad taste, a tendency to form soap scum and a tendency for hot water pipes to build up scale to the point of being blocked.
Ion exchange softening works by having the water flow past a resin that is impregnated with sodium ions; the hardness ions are exchanged with the sodium ions, leaving the water softer. The resin has to be periodically regenerated by soaking it in a salt solution, so more sodium ions are put on the resin. The brine that results is high in calcium and magnesium and has to be disposed.
Reverse osmosis works by flowing the water past a membrane that allows water to pass, but not ions, a process called osmosis. Under natural osmosis, water flows from where there is a low concentration to where there is a high salt concentration so that the high concentration zone becomes more dilute. In reverse osmosis, a high pressure is used to overcome this tendency, leading to it being called "reverse." The result is water with virtually no salt on one side of the membrane and a very concentrated salt solution on the other side to be disposed.