EDTA is predominantly used for the chelation of divalent ions, such as calcium and magnesium ions. In agarose gel electrophoresis, EDTA is added in buffer for chelating the magnesium ions which are cofactors for DNA nucleases. Hence, activity of DNA nucleases that may be present is inhibited, and DNA is protected from degrading by DNA nucleases.