Dear student,
Principle: In an electrolytic solution where electrolyte dissolves a solution and the electrodes which are the current source are immersed into the electrolytic solution. Then the Cations of the electrolyte gets attracted to the cathode and anions to the anode.
When electricity is passed through sodium chloride solution, the sodium ions and the chloride ions can separate from one another somewhat, and they are free to move throughout the liquid. Electrolysis of sodium chloride is carried out in an electrolytic cell.
The following equation represents the breaking apart of NaCl:
2NaCl(l) → 2Na(l) + Cl2(g)
The half-reactions involved in this process are:
Reduction: 2Na+(l) + 2e- → Na(s)
Oxidation 2Cl-(l) → Cl2 (g) + 2e-
On passing electricity, sodium ions are attracted near cathode. And chloride ions are attracted towards anode, chlorine gas gets evolved here.