The two strands of double-stranded nucleic acids are bonded together by hydrogen bonds between purines and pyrimidines (nitrogenous bases).
Adenine (A) is paired with Thymine (T) in DNA or Uracil (U) in RNA by two hydrogen bonds. Guanine (G) is paired with Cytosine (C) by three hydrogen bonds.
A-T, A-U and C-G pairs are called complementary base pairs.