Highly pure hydrogen can be obtained by electrolysis of water.
It is the decomposition of water into O2&H2 gas by passing electric current.
At anode, 6H2O(l)⟶O2(g)+4H3O++4e−
cathode, 4e−+4H2O(l)⟶2H2(g)+4OH−(aq)
Overall ⟶2H2O(l)⟶2H2(g)+O2(g)%