# How does the formation of covalent bonds relate to the octet rule?

For example, hydrogen atoms each have one valence electron. Two hydrogen atoms bond covalently by sharing their single valence electrons to form a covalent bond, which forms a molecule of hydrogen gas ($\text{H"_2}$).This gives them a shared pair of electrons so that each hydrogen atom effectively has two valence electrons like the noble gas helium.
An example of atoms that bond covalently to form an octet is the formation of a covalent bond between two chlorine atoms to form a molecule of chlorine gas($\text{Cl"_2}$). Each chlorine atom has seven valence electrons, one of which is unpaired and available for bonding. When two chlorine atoms share their unpaired electrons, a single covalent bond results, and each chlorine atom effectively has an octet of valence electrons, similar to the noble gas argon.
A water molecule ($\text{H"_2"O}$) is an example of a molecule in which covalent bonding forms two hydrogen atoms with effectively two valence electrons like the noble gas helium, and an octet of valence electrons for the oxygen atom, like the noble gas neon.