When an ionic substance is melted or dissolved in water (a solution has formed) the ions are free to move about within the liquid or solution.
Aluminium and copper are examples of metals purified by electrolysis.
During electrolysis, +Chargd electrons are attracted to the -Charged electrode (Cathode)
And -Charged ions move to the +Charged electrode (Anode).
The electrolysis of sodium chloride produces hydrogen, sodium hydroxide and chlorine.
These three substances can be made;
Chlorine; Kills bacteria, used in cleaning products, used to clean pool water. Bleach is made by reacting chlorine with sodium hydroxide, also some plastics such as PVC can be made.
Hydrogen; Hydrogenation, it can be sued to form other chemicals like ammonia.
Sodium hydroxide; Used to make soap, is in the manufacture of textiles paper & ceramics and can be used to purify aluminim in electrolysis.
KI (Potassium Iodide)
Anode; Iodide MgCl2 (Magnesium Chloride) Cathode; Magnesium