The Octet Rule
The octet rule is a bonding theory used to predict the molecular structure of covalently bonded molecules. Each atom will share, gain, or lose electrons in order to fill outer electron shells with eight electrons. For many elements, this rule works is quick and simple to predict the molecular structure of a molecule.
Noble gases have complete outer electron shells, which make them very stable. Other elements also seek stability, which governs their reactivity and bonding behavior. Halogens are one electron away from filled energy levels, so they are very reactive. Fluorine, for example, has seven electrons in its outer electron shell. Fluorine readily bonds with other elements so that it can have a filled energy level.