Base pairing is a fundamental principle of molecular biology where specific nitrogenous bases in nucleic acids form hydrogen bonds with their complementary bases, ensuring the accurate replication and transcription of genetic information. In DNA, adenine pairs with thymine and cytosine pairs with guanine, while in RNA, adenine pairs with uracil instead of thymine.