When compounds form, the atoms that bonded get a stable arrangement of electrons.
Compounds form because their atoms get a more stable arrangement than they had in the reactants.
A stable arrangement is a complete octet of eight electrons in the valence shell .