Sodium hydroxide is generally prepared commercially by electrolysis of sodium chloride in castner Kellner cell.
at cathode : Na+e−HgNa− amalgum
Anode :Cl−⟶21Cl2+e−
The Na-amalgam is treated with water to give sodium hydroxide and hydrogen gas : 2Na (amalgam) +H2O→2NaOH+H2+2Hg