The problem’s solution is to remove the calcium and magnesium. While there are chemical treatments that will do this, the most common answer is to invest in a water softener.
The typical water conditioner is a mechanical appliance that’s installed into your home’s water supply system. All water softeners use the same operating rule: They trade the minerals for something else, most commonly sodium. The process of this is called ion exchange.
The core of a water softener is a mineral tank. It’s filled with small polystyrene beads, also known as zeolite or resin. These beads carry a negative charge.
Magnesium and calcium in water both carry positive charges. This means that these minerals will attach themselves to the beads as the hard water goes through the mineral tank. Sodium ions also carry positive charges, although not as strong as the charge on the magnesium and calcium. When a very strong brine solution is pushed through a tank that has already has saturated beads with calcium and magnesium, the pure volume of the sodium ions is enough to drive the magnesium and calcium ions off the beads. Water conditioners have a separate brine tank that uses common salt to make this brine solution.
In normal operation, hard water moves into the mineral tank and the magnesium and calcium ions move to the beads, in turn, replacing sodium ions. The sodium ions get into the water. Once the beads are saturated with magnesium and calcium, the unit enters a 3-step regeneration cycle. First, the backwash phase reverses the flow of water to flush dirt out of the tank. During the recharge phase, the concentrated sodium-rich salt solution is passed from the brine tank through the mineral tank. The sodium collects on the beads, replacing the magnesium and calcium, which flow down the drain. Once this phase is completed, the mineral tank is cleared of excess brine and the brine tank is refilled.