Here's how it works:
* Electrons are transferred: One atom (usually a metal) loses one or more electrons, becoming a positively charged ion (cation). The other atom (usually a nonmetal) gains these electrons, becoming a negatively charged ion (anion).
* Opposite charges attract: The opposite charges of the cation and anion attract each other strongly, forming an electrostatic attraction called an ionic bond.
Example:
Sodium (Na) has one valence electron, while chlorine (Cl) has seven.
* Sodium *loses* its valence electron, becoming a sodium ion (Na+) with a positive charge.
* Chlorine *gains* this electron, becoming a chloride ion (Cl-) with a negative charge.
The resulting opposite charges of Na+ and Cl- attract each other strongly, forming an ionic bond and creating the compound sodium chloride (NaCl), also known as table salt.