Gel electrophoresis is a technique used to separate charged particles like DNA fragments by size. An electric current is applied to a gel, causing negatively charged DNA fragments to migrate towards the positive electrode. Smaller fragments travel further than larger ones. DNA is first digested with restriction enzymes to generate fragments of different lengths. The DNA fragments are then loaded into wells in an agarose or acrylamide gel submerged in buffer solution. As an electric current is applied, the fragments separate by size. After completion, the gel can be stained with dye and visualized under UV light to see the separated DNA bands. This allows analysis and recovery of specific DNA fragments.