Electrolysis is the decomposition of a substance by an electric current, where electrolytes carry current as ions in solution. During electrolysis, ions move to the electrodes and undergo oxidation or reduction reactions. At the cathode, electrons are gained and reduction occurs. At the anode, electrons are lost and oxidation occurs. The amount of substance deposited or gas produced can be calculated using Faraday's law, relating current, time, and moles of electrons in the electrode reactions.