A nucleic acid is a biological macromolecule composed of nucleotide units — each containing a sugar, a phosphate group, and a nitrogenous base — that stores, transmits, and expresses genetic information in all living organisms and viruses. The two principal types are deoxyribonucleic acid (DNA), which carries the hereditary blueprint of an organism, and ribonucleic acid (RNA), which plays key roles in gene expression, protein synthesis, and cellular regulation.