I'm learning about the octet rule and stability -- that the most common and preferred state of atoms/molecules are those which have the lowest energy or most stability. When an atom's valence shell has an octet it is the most stable, like the noble gases; and that many atoms lose or gain electrons to reach this octet state. However, I also read that the atoms that gain or lose electrons are also less stable because the number of protons and electrons no longer match -- the atom now has a net positive or negative charge.
So I was wondering which state do atoms prefer the most? Forming the octet in their valence shells or staying neutral by having the same number of protons and neutrons electrons? Also, if an atom gains electrons to make an octet, then doesn't this counter it desiring the lowest energy state? And isn't this loss of lowest-energy stability exacerbated by the net charge no longer being neutral?
Thank-you
Mod Edit : changed to strike through for clarity.