Materials Science and Engineering/List of Topics/Octet Stability by Electron Sharing

The octet rule is a simple chemical rule of thumb that states that atoms 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. In simple terms, molecules or ions tend to be most stable when the outermost electron shells of their constituent atoms contain eight electrons.

Overview
In short, an element's valence shell is full and most stable when it contains eight electrons (this stability is the reason that the noble gases are so unreactive). Note that a "full shell" means that there are the eight electrons in the valence shell when the next shell starts filling, even though higher subshells (d, f, etc.) have not been filled. There can be at most eight valence electrons in a ground-state atom because p subshells are always followed by the s subshell of the next shell. This means that once there are 8 valence electrons (when the p subshell is filled), the next additional electron goes into the next shell, which then becomes the valence shell.

History
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 “co-ordination number”) is often 4 or 6; other coordination numbers up to a maximum of 8 occur, but less frequently. In 1904 Richard Abegg formulated what is now known as Abegg's rule, which states that the difference between the maximum positive and negative valences of an element is frequently eight. This rule was used later in 1916 when Gilbert N. Lewis formulated the “octet rule” in his cubical atom theory.