The re-use of wastewater is an increasingly important subject. Most recently, several attempts were reported to convert wastewater in harmless or even valuable substances by the use of electrical current. Electrochemistry is an old approach. The renewed interest stems from the fact that electrical current is often available in abundance, for example from solar energy in arid regions, while clean water is not. Experimentally, one has to deal with very many products which are the result of many reaction steps. Here, theory can help. Using Car–Parrinello molecular dynamics, we simulate the first few reaction steps of the electrolysis of wastewater. On the basis of previous studies, we investigate the reaction of carbon dioxide and nitrogen compounds. The results show a great variety of reaction steps and resulting products. Some of them are technologically interesting, such as hydrogen and formic acid.