The octet rule is a chemical rule of thumb that states that atoms of low (<20) atomic number tend to combine in such a way that they each have eight electrons in their valence shells, giving them the same electronic configuration as a noble gas. The rule is applicable to the main-group elements, especially carbon, nitrogen, oxygen, and the halogens, but also to metals such as sodium or magnesium.
The valence electrons can be counted using a Lewis electron dot diagram as shown at right for carbon dioxide. The electrons shared by the two atoms in a covalent bond are counted twice. In carbon dioxide each oxygen shares four electrons with the central carbon, and these four electrons are counted in both the carbon octet and the oxygen octet.
Example: sodium chloride 
Ionic bonding is common between pairs of atoms, where one of the pair is a metal (such as sodium) and the second a non-metal (such as chlorine).
A chlorine atom has seven electrons in its outer electron shell, the first and second shells being filled with two and eight electrons respectively. The first electron affinity of chlorine (the energy release when chlorine gains an electron) is +328.8 kJ per mole of chlorine atoms. Adding a second electron to chlorine requires energy, energy that cannot be recovered by formation of a chemical bond. The result is that chlorine will very often form a compound in which it has eight electrons in its outer shell (a complete octet).
A sodium atom has a single electron in its outermost electron shell, the first and second shells again being full with two and eight electrons respectively. To remove this outer electron requires only the first ionization energy), which is +495.8 kJ per mole of sodium atoms, a small amount of energy. By contrast, the second electron resides in the deeper second electron shell, and the second ionization energy required for its removal is much larger: +4562.4 kJ per mole. Thus sodium will, in most cases, form a compound in which it has lost a single electron and have a full outer shell of eight electrons, or octet.
The energy required to transfer an electron from a sodium atom to a chlorine atom (the difference of the 1st ionization energy of sodium and the electron affinity of chlorine) is small: +495.8 − 328.8 = +167 kJ mol−1. This energy is easily offset by the lattice energy of sodium chloride: −787.3 kJ mol−1. This completes the explanation of the octet rule in this case.
In the late 19th century it was known that coordination compounds (formerly called “molecular compounds”) were formed by the combination of atoms or molecules in such a manner that the valencies of the atoms involved apparently became satisfied. In 1893, Alfred Werner showed that the number of atoms or groups associated with a central atom (the “coordination number”) is often 4 or 6; other coordination numbers up to a maximum of 8 were known, but less frequent. In 1904 Richard Abegg was one of the first to extend the concept of coordination number to a concept of valence in which he distinguished atoms as electron donors or acceptors, leading to positive and negative valence states that greatly resemble the modern concept of oxidation states. Abegg noted that the difference between the maximum positive and negative valences of an element under his model is frequently eight. Gilbert N. Lewis referred to this insight as Abegg's rule and used it to help formulate his cubical atom model and the "rule of eight", which began to distinguish between valence and valence electrons. In 1919 Irving Langmuir refined these concepts further and renamed them the "cubical octet atom" and "octet theory". The "octet theory" evolved into what is now known as the "octet rule".
Explanation in quantum theory 
The quantum theory of the atom explains the eight electrons as a closed shell with an s2p6 electron configuration. A closed-shell configuration is one in which low-lying energy levels are full and higher energy levels are empty. For example the neon atom ground state has a full n=2 shell (2s2 2p6) and an empty n=3 shell. According to the octet rule, the atoms immediately before and after neon in the periodic table (i.e. C, N, O, F, Na, Mg and Al), tend to attain a similar configuration by gaining, losing, or sharing electrons.
The argon atom has an analogous 3s2 3p6 configuration. There is also an empty 3d level, but it is at considerably higher energy than 3s and 3p (unlike in the hydrogen atom), so that 3s2 3p6 is still considered a closed shell for chemical purposes. The atoms immediately before and after argon tend to attain this configuration in compounds. There are, however, some hypervalent molecules in which the 3d level may play a part in the bonding, although this is controversial (see below).
For helium there is no 1p level according to the quantum theory, so that 1s2 is a closed shell with no p electrons. The atoms before and after helium (H and Li) follow a duet rule and tend to have the same 1s2 configuration as helium.
- The duet rule of the first shell—the noble gas helium has two electrons in its outer shell, which is very stable. (Since there is no 1p subshell, 1s is followed immediately by 2s, and thus shell 1 can only have at most 2 valence electrons). Hydrogen only needs one additional electron to attain this stable configuration, while lithium needs to lose one.
- Some reactive species such as carbenes have incomplete valence shells. These molecules often react so as to complete their octet.
- Some compounds with intermediate ionic-covalent character like boron trifluoride, silicon tetrafluoride, boron trioxide and silicon dioxide do not have a full octet valence shell due to their high ionicity. Such compounds are often good Lewis acids, which can react readily with Lewis bases.
- Free radicals (e.g. chlorine radical responsible for ozone depletion) contain atoms that have an odd number of electrons.
- For transition metals, the dodectet rule replaces the octet rule, due to the utilization of valence s and d orbitals (e.g., compounds such as the permanganate ion). Although the 18-Electron rule is universally used for many transition metal complexes, newer theoretical treatments support a model with the dodectet rule and the same explanation as typically employed for hypervalent molecules (See below).
- Certain free radicals (e.g. nitric oxide) do obtain octet configurations by means of a three-electron bond. Ground-state oxygen is actually a free radical (diradical) with two such bonds, which is universally represented as obeying the octet rule.
- Hypervalent molecules in which main group elements exhibit more than four bonds, for example phosphorus pentachloride, PCl5, and sulfur hexafluoride, SF6. The bonding in such molecules has been controversial. The outdated model considers that the P and S atoms (in PCl5 and SF6 respectively) form five and six true covalent bonds with the participation of d orbitals, in violation of the octet rule. The newer accepted model describes such molecules with non-bonding MOs (Molecular orbital theory) or resonance (Valence bond theory) and conforms to the octet rule and is supported by ab initio molecular orbital calculations, which show that the contribution of d functions to the bonding orbitals is small.
See also 
- Abegg, R. (1904). "Die Valenz und das periodische System. Versuch einer Theorie der Molekularverbindungen (Valency and the periodic system - Attempt at a theory of molecular compounds)". Zeitschrift für anorganische Chemie 39 (1): 330–380. doi:10.1002/zaac.19040390125.
- Lewis, Gilbert N. (1916). "The Atom and the Molecule". Journal of the American Chemical Society 38 (4): 762–785. doi:10.1021/ja02261a002.
- Langmuir, Irving (1919). "The Arrangement of Electrons in Atoms and Molecules". Journal of the American Chemical Society 41 (6): 868–934. doi:10.1021/ja02227a002.
- Ronald J. Gillespie (1998). "Covalent and Ionic Molecules: Why Are BeF2 and AlF3 High Melting Point Solids whereas BF3 and SiF4 Are Gases?". Journal of Chemical Education 75 (7): 923. doi:10.1021/ed075p923.
- Weinhold, Frank; Landis, Clark R. (2005). Valency and bonding: A Natural Bond Orbital Donor-Acceptor Perspective. Cambridge: Cambridge University Press. ISBN 0-521-83128-8.