In replicating the DNA, there is the possibility of introducing mutations through errors in base-pairing. To limit this possibility, mismatched bases can be detected and repaired during replication.
In prokaryotes, DNA Polymerase III, which is responsible for the 5′ → 3′ elongation of the newly synthesized strand, can exercise 3′ → 5′ exonuclease activity. That is, DNA Pol III can proofread upstream (3′ → 5′; the opposite direction of elongation) the last nucleotide added and, if an error is found, excise and correct it. DNA Polymerase I, which is also responsible for removal and replacement of the RNA primer, provides 5′ → 3′ exonuclease activity to repair mismatches in the direction of elongation.
Errors that escape correction during replication can still be identified and repaired later by a mismatch repair mechanism, a concert of mismatch repair proteins that identify mismatched bases by way of characteristic distortion of the sugar-phosphate backbone. Once mismatches are found, the incorrect match is excised (via exonuclease), replaced (via polymerase) with the correct nucleotide, and joined (via ligase) to its adjacent nucleotides in the strand.
More complex but similar processes of DNA repair during and after replication take place in eukaryotes.