Electrolysis is the process of using electricity to split water into hydrogen and oxygen gases. It works by passing an electric current through water, which separates the water into its basic elements. Salty water is used because the salt allows electricity to flow better through the solution during electrolysis.