Can hydrogen and oxygen gasses be turned back into water?
When hydrogen burns, pure water is created; the reaction is exactly the reverse of the electrolysis and shown in the equation below.

$$\ce{2 H2 + O2 -&gt; 2 H2O}$$

If you just have hydrogen, then it will burn with a flame as you might know from a methane gas flame. However, once you have a certain mixture of hydrogen and oxygen gas in your container, the reaction becomes explosive. If you have the exact stoichiometric mixture of $2:1$, the reaction is a very strong (and loud) explosion; a tiny amount created a louder bang in Munich’s chemistry lecture hall than all other explosions the experimentors showed on that day.

The fact that hydrogen burns to give water and only pure water (vapour) was one of the main points used to try and sell hydrogen-powered cars, since water vapour is environmentally friendly and does not cause global heating like $\ce{CO2}$ does.



The electrolysis/explosion difference shows how different conditions for forwards and backwards reaction can be.

It bears repeating: do not attempt the combustion at home unless you know exactly what you are doing!