An electrolyzer consists of two electrodes submerged in water, typically with an electrolyte solution added. When an electric current is passed through the electrodes, water molecules are split into hydrogen ions (H+) and hydroxide ions (OH-). The hydrogen ions migrate towards the negative electrode (cathode), where they gain electrons and form hydrogen gas (H2). The hydroxide ions migrate towards the positive electrode (anode), where they lose electrons and form oxygen gas (O2).