Electrolysis is a process in which electrical energy, from a direct current (dc) supply, breaks down electrolytes. the free moving ions in electrolytes are attracted to the oppositely charged electrodes which connect to the dc supply.The electrolyte CaCl2 (Calcium Chloride) is made up of Ca2+ and Cl- ions. The Ca2+ positive ions gain electrons from the negatively charged cathode and form calcium atoms while the Cl- negative ions lose electrons at the positively charged anode to form chlorine atoms- the atoms join up in pairs to form Cl2 molecules, so chlorine gas is formed at the positive electrode.