Chlorine gas is obtained at the anode during the electrolysis of molten sodium chloride.
During the electrolysis of molten sodium chloride, the ions present are sodium and chlorine ions. Sodium ions are cations which are attracted to the cathode and chloride ions are anions which are attracted to anodes. Each sodium ion gains one electron to form the sodium atom. Each chloride loses one electron to form chlorine atoms.
At cathode: Na++e−→Na(s)
At anode: 2Cl−→Cl2(g)+2e−
Overall reaction: 2Na++2Cl−→Na(s)+Cl2(g)
At cathode sodium will be formed and at anode chlorine gas will be formed.