DNA and RNA have similar but different chemical structures
The general structure for the monomeric units for DNA and RNA—the nucleoside monophosphates, or nucleotides—involves a five-carbon sugar attached to a base unit and a phosphate (Figure 1). The mononucleotides are members of a whole class of nucleoside phosphates, many of which have other biological roles; for example, adenosine triphosphate (ATP) and guanosine triphosphate (GTP) are important energy currencies in the cell. In each case, the phosphate is attached to the 5′-carbon of the sugar, and in the polynucleotide, there is a phosphodiester link to the 3′-carbon of the next residue (see Figure 4). The sugars involved are ribose in RNA and 2′-deoxyribose in DNA.

Fig1. Chemical composition of nucleotides. Nucleotides contain a five-carbon (pentose) sugar—either deoxyribose in DNA, as shown here, or ribose in RNA (see Figure 2)—as well as a nitrogenous base and phosphate group(s). The base and sugar together form a nucleoside; depending on the number of phosphate groups attached to a nucleoside, it may be designated a nucleoside mono-, di-, or triphosphate. Nucleic acids are made of nucleoside monophosphates, shaded in blue, which contain nitrogenous bases that are derivatives of either pyrimidine or purine.
The bases are all derived from either purine or pyrimidine, shown in Figure 4.1. The kinds of bases found in nucleic acids are shown in Figure 2A. The basic groups contained in nucleic acids are always attached to the 1′-carbon of the sugar. Four different kinds are found in DNA: adenine (A), guanine (G), cytosine (C), and thymine (T). RNA contains the same bases except that uracil (U) substitutes for thymine. A ribose or deoxyribose with a base attached is called a nucleoside (Figure2B). When a phosphate group is attached to the 5′-carbon of the sugar, a nucleotide, also called a nucleoside 5′-phosphate, is obtained (see Figure 1).

Fig2. Nucleosides in RNA and DNA. (A) Chemical formulas of pyrimidines and purines. Uracil, shown in the box, is present only in RNA. (B) Differences between the nucleosides in DNA and RNA are highlighted in red. The table shows the nomenclature of nucleosides formed by the addition of each base to the respective pentose.
As depicted in Figure 3A, the sugar moiety of nucleic acids is in the ring or β-furanose form. To a first approximation, we may say that four of the five atoms of the ring lie in the same plane; the position of the fifth atom, either C-2′ or C-3′, with respect to the plane determines whether the conformation is that of an endonucleoside, with the fifth atom on the same side of the plane as the C-5′ atom, or an exonucleoside, with the fifth atom on the opposite side of the plane. Actually the situation is more complex, with a variety of slightly different sugar conformations found. Nucleosides also have two conformations determined by the non-free rotation around the glycosidic bond (Figure 3B). The preferred conformation in nucleic acids is the anti conformation, in which the base and the sugar ring are as far away from each other as possible. As an example, Figure 4.3C shows the structure of the entire nucleoside monophosphate unit of deoxyguanosine monophosphate (dGMP).

Fig3. Conformations of nucleotide components. (A) Conformation of the ribose ring. In solution, there is equilibrium between the straight-chain or aldehyde form and the ring or β-furanose form of ribose; RNA contains only the ring form. The ribofuranose rings in nucleotides exist in two different puckered conformations: four of the five atoms in the ring lie in a single plane, while the fifth atom, C-2′ or C-3′, is either on the same side of the plane as the C-5′ atom, in endonucleosides, or on the opposite side, in exonucleosides. (B) Syn and anti conformations of nucleosides. Rotation around the glycosidic bonds allows the existence of two nucleoside conformations: syn and anti. In solution, purines rapidly equilibrate between the two conformers, while in pyrimidines the anti predominates. In nucleic acids, the preferred conformation is anti. (C) The three-dimensional structure of deoxyguanosine 5′-monophosphate (dGMP); hydrogen atoms have been omitted for clarity. The plane of the purine ring is almost perpendicular to that of the furanose ring. The purine base is in the anti conformation. The sugar ring is puckered in the 3′-exo conformation. The phosphoryl group attached to the C-5′ atom is positioned well above the sugar and far away from the base.
Nucleic acids (polynucleotides) are polymers of nucleotides
Polynucleotides, or nucleic acids, can be visualized as being formed by the removal of a water molecule between the 5′-phosphate of one nucleotide and the 3′-hydroxyl of another. As in protein formation, this is not how it actually happens in the cell. Addition of a nucleoside triphosphate with elimination of pyrophosphate more closely describes the process; see Figure 4. The chains can be very long, involving millions or even billions of nucleotide residues. Nucleic acids are acidic because the linking phosphate groups carry negative charges. Like proteins, most nucleic acids have unique sequences. Note that there is an unreacted phosphate on one end of the chain, called the 5′-end, and an unreacted hydroxyl at the other end known as the 3′-end, except in cases where the molecule is circular. Thus, each polynucleotide chain has polarity (Figure 5).

Fig4. The phosphodiester bond. In DNA and RNA, the phosphodiester bond is the linkage between the C-3′ atom of one sugar molecule and the C-5′ atom of another, through the 5′-phosphate and a 3′-OH group.

Fig5. A tetranucleotide. The backbone of the chain is formed by the phosphates and sugars, marked in alternating blue and red for the successive nucleotide residues; bases are indicated by the circled letters. Note that the chain possesses polarity: the 5′-end and the 3′-end are chemically different. Reading the sequence from the top, in the 5′ → 3′ direction, will give ATCG; reading from the bottom, in the 3′ → 5′ direction, will give GCTA. By convention, nucleotide sequences in nucleic acids are written and read from 5′ to 3′.
The sugar–phosphate backbone of any nucleic acid is repetitious and uniform; the sequence uniqueness is carried by the order of the attached basic groups. Thus, we can compactly write the unique sequence of a DNA molecule as in this example, AGTCCTAAGCCTT, starting with the base at the 5′-end on the left according to convention. In RNA, uracil substitutes for thymine, and so the corresponding RNA poly nucleotide chain would read AGUCCUAAGCCUU.