Ionic bonding occurs between a metal and non-metal when one atom transfers electrons to the other. This transfer of electrons results in the formation of oppositely charged ions - cations are formed when electrons are donated and anions are formed when electrons are gained. For example, in sodium chloride, sodium donates an electron to chlorine. Sodium becomes a cation with a +1 charge and chlorine becomes an anion with a -1 charge. The electrostatic attraction between these oppositely charged ions forms the ionic bond in sodium chloride.