Ionic bonding is the principal interaction in ionic compounds and includes the electrostatic attraction between oppositely charged ions or between two atoms with drastically differing electronegativities.
An ionic bond is seen between Sodium Chloride ().
A neutral Sodium () atom is likely to achieve an octet in its outermost shell by losing its one valence electron, so, Sodium donates an electron to Chlorine () and acquires a positive charge.
Chlorine will get an electron (a negatively charged particle) from Sodium, because it is more energy-efficient for Chlorine to gain one electron than to lose seven in order to acquire a stable octet.
This makes Sodium slightly positive and Chlorine slightly negative. Sodium becomes cation, and Chlorine becomes anion. Thus, Sodium is reduced as it donates the electron, and Chlorine gains an electron and is oxidized.
These two ions are held together by electrostatic force of attraction
Hence, in this way, Sodium Chloride is formed by electron transfer.