An electric current is passed through the water in an electrolysis bath, the water’s positive ions will be attracted to the cathode while the negative ions will be attracted to the anode.
The water (H2O) is thus separated into its two constituents: H2 (hydrogen) and O (oxygen).
The hydrogen and oxygen can then be stored and retrieved for later use.