The net charge in water must always be neutral. Therefore, if you remove positively charged calcium ions, either of two things must occur: An equivalent amount of negatively charged ions (such as bicarbonate) must be removed or the calcium ions must be replaced with other positively charged ions (such as sodium). Ion-exchange resins work by removing the ions we want to remove and replacing them with other ions of the same type of charge that don’t contribute to hardness. Usually, they replace calcium ions with sodium, exchanging two sodium ions (Na+) for each calcium ion (Ca2+).
A typical water filter is shaped like a long column and filled with beads of polymer resin. The small beads provide a large surface area to contact the water as it flows past. In the case of a calcium-exchange filter, the resin is made of a polymer that binds positively charged ions. The resin is designed to bind to calcium and magnesium more strongly than to sodium. Initially, the resin is saturated with sodium ions — thus, sodium ions at the surface of each bead are available to be exchanged.
When hard water flows past the resin, the calcium and magnesium ions bind to the polymer, displacing the sodium into the water. The water flowing out of the filter is therefore softer, but it contains more sodium than it did before.
The above illustrates shows the path of hard water as it encounters an ion exchange resin. Left: Hard water flows in. Middle: Calcium and magnesium ions exchange with sodium ions on the resin surface. Right: Soft water with sodium ions added flows out.
Once the resin is exhausted, it can be regenerated by passing it over a strong salt solution, forcing the sodium to bind to the resin again so the filter can be reused.