Electrolysis is the process of using electric current to drive an otherwise non-spontaneous chemical reaction. It involves the decomposition of an ionic compound into its constituent ions at the electrodes when an electric current is passed through it. Common examples include the electrolysis of water into hydrogen and oxygen gases or the extraction of reactive metals like sodium and potassium from their molten salts.