To carry out electrolysis, the electrolyte is placed in a beaker and two electrodes are dipped in. They are connected to a direct current power supply. The electrode joined to the positive terminal is the anode and the one joined to the negative terminal is the cathode. Products form on, or near, the electrodes.
Inert electrodes, such as graphite or platinum, do not react. They only carry the current to and from the electrolyte. The products are the ones predicted from the ions present, such as copper and oxygen from copper sulfate solution.
Non-inert electrodes, such as copper, can react. If copper electrodes are used in copper sulfate solution, the anode dissolves: Cu → Cu2+ + 2e-. Copper is deposited on the cathode: Cu2+ + 2e- → Cu. The anode loses mass and the cathode will gain the same mass. The blue colour of the solution stays the same, because copper ions are made at the anode as fast as they are used up at the cathode.
This is used to purify copper, with impure copper as the anode, and for electroplating. In electroplating the object to be plated is the cathode and the plating metal is the anode.