Electrolysis of water

decomposition of water into oxygen and hydrogen gas due to the passage of an electric current

Electrolysis of water is the decomposition of water into oxygen and hydrogen gas. This technique can be used to produce breathable oxygen or hydrogen gas as a fuel source, referred to as hydrogen fuel. However, that method is more expensive than the industrial way to produce hydrogen fuel from natural gas.[source?]

A diagram of the electrolysis of water.

This is what is referred to as a non-spontaneous reaction which requires impetus.

At the cathode, reduction (in this case, the gain of electrons) occurs. At the anode, oxidation (in this case, the loss of electrons) occurs. Normally, the reaction is balanced with either an acid or a base as shown in the equations below.

the reduction at cathode: 2 H+(aq) + 2e → H2(g)
the oxidation at anode: 2 H2O(l) → O2(g) + 4 H+(aq) + 4e

That two reactions are half reactions. They are balanced with an acid. Commonly hydrochloric acid or sulfuric acid is used. However, the half reactions can also be balanced with a base, for example with sodium hydroxide.

the reduction at cathode: 2 H2O(l) + 2e → H2(g) + 2 OH(aq)
the oxidation at anode: 4 OH(aq) → O2(g) + 2 H2O(l) + 4 e

Combining one pair of half reactions leads to an overall reaction, which is then the decomposition of water into oxygen and hydrogen.

complete reaction: 2 H2O(l) → 2 H2(g) + O2(g)