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 octet rule is only applicable to main-group elements, and only the s and p electrons are involved in the octet rule, making it useful for the main group elements (elements not in the transition metal or inner-transition metal blocks); an octet in these atoms corresponds to an electron configuration ending with s²p⁶. The octet rule can be observed in the bonding between the carbon and oxygen atoms in a carbon dioxide molecule, as illustrated via a Lewis dot structure. Achieving the octet rule can be done through either ionic or covalent bonds, where atoms share electrons or transfer electrons between each other. However, not all elements and compounds follow the octet rule, and some of the exceptions to this rule include free radicals, transition metals, and some compounds such as SF6 and XeF2.