Sodium hydroxide (NaOH) is prepared by the salt sodium chloride via electrolysis known as chlor-alkali electrolytic method. In this process chlorine gas is given of at the anode and hydrogen gas at the cathode. Sodium hydroxide solution is formed near the cathode.
2NaCl + 2H2O ---> Cl2 + 2NaOH +H2