Ionic bonding is the transferring of electrons in the highest occupied energy levels (shells) of atoms.
Atoms have no overall charge and therefore are neutral. In an atom the number of electrons (negative charges) in the shells is equal to the number of protons (positive charges) in the nucleus. By forming chemical bonds, atoms become more stable as they have full outer shells.
When atoms form chemical bonds by transferring electrons, they form ions.
Atoms that lose electrons become positive charged ions. The number of positively charges protons in the nucleus is greater than the remaining negatively charged electrons in the shells.
Atoms that gain electrons become negative charged ions. The number of positively charged protons in the nucleus is lesser than the number of negatively charged electrons in the shells.
Ions have the electronic structure of a noble gas i.e. full outer shells.
Ionic bonds form between metals and non metals
The oppositely charged ions attract and are arranged by electrostatic attraction in a way to form giant ionic crystal lattices. The ions in a crystal lattice are very strongly bonded, and a high temperature is required to melt the crystal.
Examples: Sodium Chloride, Magnesium Oxide and Calcium Chloride are some examples of molecules with ionic bonds.
View this animation to see how an ionic bond is formed in ionic compounds: