The octet rule is a chemical rule of thumb that reflects the theory that main-group elements tend to bond in such a way that each atom has eight electrons in its valence shell, giving it the same electronic configuration as a noble gas. The rule is especially applicable to carbon, nitrogen, oxygen, and the halogens, although more generally the rule is applicable for the s-block and the p-block of the periodic table. Other rules exist for other elements, such as the duplet rule for hydrogen and helium, or the 18-electron rule for transition metals. The valence electrons can be counted using a Lewis electron dot diagram as shown below for carbon dioxide: The electrons shared by the two atoms in a covalent bond are counted twice, once for each atom. In carbon dioxide, each atom shares four electrons with the central carbon, two (shown in red) from the oxygen itself, and two (shown in black) from the carbon. All four of these electrons are counted both in the carbon octet and the oxygen o