# How was water formed if oxygen and hydrogen exist as molecules?

I have learnt that both hydrogen and oxygen exist as molecules. If so how was $\ce {H2O}$ formed?

In water there is two hydrogen molecule and one oxygen atoms but how is this possible? Oxygen only exists as a molecule in our earth then how does the molecule oxygen react with molecule hydrogen to form water.

Moreover, if water is formed by combining of hydrogen and oxygen molecules, then the chemical formula of water should be $\ce{H2O2}$, shouldn't it?

• So what if oxygen exists as molecules? Molecules can be broken. – Ivan Neretin Mar 29 '18 at 6:05
• If you look at Standard Gibbs free energy of formation of $\ce {H2O}$ and $\ce {H2O2}$, you would find some reasoning (for reasonable values, see: !en.wikipedia.org/wiki/Standard_Gibbs_free_energy_of_formation). – Mathew Mahindaratne Mar 29 '18 at 7:00
• I didn't understand Standard Gibbs free energy of formation of H2O and H2O2 – Akash. B Mar 29 '18 at 7:27