Nucleobases are naturally occurring compounds, which form the differentiating component of nucleotides; five bases occur in nature, three of which are common to RNA and DNA (uracil replaces thymine in RNA).

Bases are divided into two groups, purines and pyrimidines, based on their chemical structure. Purines are larger, double-ring molecules comprising adenine and guanine, whereas pyrimidines have only a single-ring structure and comprise cytosine and thymine/uracil. Because of the different size of the two types of nucleobases, purines can only base pair with pyrimidines in order to preserve the DNA molecule's constant width. More specifically, the only base pairs that will fit the structure of the particular molecule are adenine-thymine and cytosine-guanine. Accordingly, we say that these pairs of bases are complements of each other.

In the figure below, we see the basepairing interactions of nucleobases in RNA. Bases are shown in blue.