heteroaromatic compound
/ HET-er-oh-air-oh-MAT-ik /
A heteroaromatic compound is an aromatic ring that includes at least one atom other than carbon, most often nitrogen, oxygen, or sulfur, in the ring itself. The prefix hetero means different, signaling that not every ring atom is carbon. These rings keep all the aromatic privileges of benzene, the flatness, the delocalized pi cloud, the stability, but with a different atom woven into the loop, which subtly changes their chemistry.
The key new idea is how a heteroatom's electrons count toward the pi system. The rule is to ask which orbital a lone pair sits in. In pyridine, the nitrogen replaces a CH, contributes one electron to a ring double bond just like a carbon would, and keeps its lone pair in an sp2 orbital lying in the plane of the ring, pointing outward, not part of the pi loop; so pyridine has six pi electrons (three double bonds) and is aromatic, with a basic, available lone pair sticking out. In pyrrole, furan, and thiophene, the heteroatom instead donates a lone pair into the pi system: each has two ring double bonds (four pi electrons) plus a heteroatom lone pair in a p orbital (two more), giving six pi electrons total, aromatic. Because that lone pair is busy holding the ring together, it is far less available, so pyrrole is a very weak base.
Heteroaromatic rings are everywhere in biology and medicine. The imidazole ring in the amino acid histidine, the pyrimidine and purine rings of DNA and RNA bases, the porphyrin ring in heme and chlorophyll, and a large fraction of all pharmaceutical drugs are built on heteroaromatic cores. Understanding how lone pairs count, in-plane versus in the pi system, lets you predict whether a given nitrogen will be basic or not, which is one of the most practically important questions in drug chemistry.
Imidazole, a five-membered ring with two nitrogens, has one pyridine-like nitrogen (lone pair in plane, basic) and one pyrrole-like nitrogen (lone pair in the pi system, not basic); this dual nature is exactly why histidine is so useful at enzyme active sites.
Whether a heteroatom's lone pair joins the pi loop decides its basicity.
Counting a lone pair into the pi system is only correct if it occupies a p orbital aligned with the ring; an in-plane sp2 lone pair (as in pyridine) does not count toward the 4n+2 total and stays free to act as a base.