Domestic softeners typically treat the water to the whole house. They are salt-regenerated, ion-exchange units which contain ion exchange resin. This resin contains sodium ions which “swap places” with calcium (together with magnesium and some other trace metal ions such as iron and aluminium) as the water passes through. So calcium and magnesium are taken out of the water and sodium is put in.
When the sodium ions on the resin are used up, the softener is taken off line automatically and regenerated. The regenerant is common salt (sodium chloride) solution (brine) and, during regeneration, the exchange process is reversed so sodium goes back onto the resin and the calcium and magnesium are flushed out to drain. The softener is then ready to go back on line for another cycle.