The octet rule is a strong guide for carbon, nitrogen, oxygen and fluorine, but not a law. With Formal Charge in hand, here are the three kinds of exceptions, and why each happens.
Key idea
Odd-electron species (free radicals) such as $\mathrm{NO}$ (11 valence electrons) and $\mathrm{NO_2}$ (17) cannot pair every electron: one atom ends up with 7. Electron-poor atoms, boron and beryllium, are stable with 6 or 4 electrons, as in $\mathrm{BF_3}$ and gaseous $\mathrm{BeCl_2}$. Expanded octets: central atoms in period 3 and beyond (P, S, Cl, Xe, I…) can have 10 or 12 electrons around them, as in $\mathrm{PCl_5}$ and $\mathrm{SF_6}$. Period 2 atoms never exceed 8.
Why it works
An odd total can't be split into pairs; that is arithmetic. Boron has only 3 valence electrons; making a fourth bond would need a double bond to fluorine that puts a $+1$ formal charge on the very electronegative F, so $\mathrm{BF_3}$ keeps an empty spot, and it readily accepts a lone pair from $\mathrm{NH_3}$ to fill it. Period 2 atoms have only four valence orbitals (one 2s, three 2p), room for 8 electrons. Atoms in period 3 and below are larger, so more atoms fit around them, and their Lewis structures can show 10 or 12 electrons. (Older books credited empty d orbitals for this; modern calculations show they play little part, but the counting is the same.)
Worked example: Count the electrons around xenon
Draw the Lewis structure of $\mathrm{XeF_4}$. How many electrons surround the xenon?
- Valence electrons: Xe 8, F $4 \times 7 = 28$: total 36.
- Four Xe–F bonds use 8; each F gets 3 lone pairs: $4 \times 6 = 24$. Used: 32.
- The last 4 electrons go on Xe as 2 lone pairs.
- Around Xe: 4 bonds (8 electrons) + 2 lone pairs (4) = 12 electrons, an expanded octet.
Answer: 12 electrons.
Worked example: An odd-electron molecule
Nitrogen dioxide, $\mathrm{NO_2}$, has how many valence electrons, and which atom is short of an octet?
- N 5 + O $2 \times 6 = 12$: total 17, an odd number.
- Best structure: O=N–O with the single-bonded O holding 3 lone pairs, the double-bonded O 2 lone pairs, and one unpaired electron on N.
- N has $4 + 2 + 1 = 7$ electrons around it.
Answer: 17 electrons; nitrogen has 7. ($\mathrm{NO_2}$ pairs up into $\mathrm{N_2O_4}$, joining the two odd electrons.)
Common mistake
Two opposite mistakes. One is giving a period 2 atom more than eight electrons, such as drawing nitrogen with five bonds; nitrogen has no room for a fifth. The other is forcing an octet on every atom even when the electron count is odd, which can't be done. Check: count the total valence electrons first. If it is odd, expect a radical; if the central atom is from period 3 or below and the outer atoms are many halogens, expect an expanded octet.