Gel electrophoresis is a technique that involves separation of DNA by a gel matrix using an electric field. Charged molecules move across the gel and get separated based on their size. Since DNA is a negatively charged molecule, it will move towards the positively charged end in an electric field. While moving across the gel matrix, the bigger and heavier fragments move slowly and are left behind while the smaller fragments move faster. This way the different fragments obtained after using restriction enzyme are separated.