Water softening is the removal of calcium, magnesium, and certain other metal cations in hard water. The resulting soft water requires less soap for the same cleaning effort, as soap is not wasted bonding with calcium ions.
Soft water also extends the lifetime of plumbing by reducing or eliminating scale build-up in pipes and fittings. Water softening is usually achieved using lime softening or ion-exchange resins but is increasingly being accomplished using nanofiltration or reverse osmosis membranes.
Image source: https://www.myhomewatertreatment.com/wp-content/uploads/2017/01/whole-house-filtration-system-diagram.jpg