The term "nucleic acid" is the generic name for a family of biopolymers, named for their role in the cell nucleus. The monomers from which nucleic acids are constructed are called nucleotides.
Each nucleotide consists of three components: a nitrogenous heterocyclic base, which is either a purine or a pyrimidine; a pentose sugar; and a phosphate group. Nucleic acid types differ in the structure of the sugar in their nucleotides - DNA contains 2-deoxyribose while RNA contains ribose (where the only difference is the presence of a hydroxyl group). Also, the nitrogenous bases found in the two nucleic acid types are different: adenine, cytosine, and guanine are found in both RNA and DNA, while thymine only occurs in DNA and uracil only occurs in RNA. Other rare nucleic acid bases can occur, for example inosine in strands of mature transfer RNA.
Nucleic acids are usually either single-stranded or double-stranded, though structures with three or more strands can form. A double-stranded nucleic acid consists of two single-stranded nucleic acids held together by hydrogen bonds, such as in the DNA double helix. In contrast, RNA is usually single-stranded, but any given strand may fold back upon itself to form secondary structure as in tRNA and rRNA. Within cells, DNA is usually double-stranded, though some viruses have single-stranded DNA as their genome. Retroviruses have single-stranded RNA as their genome.
The sugars and phosphates in nucleic acids are connected to each other in an alternating chain, linked by shared oxygens, forming a phosphodiester bond. In conventional nomenclature, the carbons to which the phosphate groups attach are the 3' end and the 5' end carbons of the sugar. This gives nucleic acids polarity. The bases extend from a glycosidic linkage to the 1' carbon of the pentose sugar ring. Bases are joined through N-1 of pyrimidines and N-9 of purines to 1' carbon of ribose through N-? glycosyl bond.