Water softener salt works by exchanging sodium ions for calcium and magnesium ions through a process called ion exchange. As hard water flows through the resin bed in the water softener tank, the resin beads attract and hold onto the calcium and magnesium ions, releasing sodium ions in their place. This exchange process effectively softens the water, preventing scale buildup and providing the benefits of softened water throughout the household.