An ionic compound such as sodium chloride is held together by an ionic bond. This type of bond is formed when oppositely charged ions attract. This attraction is similar to that of two opposite poles of a magnet. An ion or charged atom is formed when the atom gains or loses one or more electrons. It is called a cation if a positive charge exists and an anion if a negative charge exists.
Sodium (chemical symbol Na) is an alkali metal and tends to lose an electron to form the positive sodium ion (Na+). Chlorine (chemical symbol Cl) is a nonmetal and tends to gain an electron to form the negative chloride ion (Cl-).
The oppositely charged ions Na+ and Cl- attract to form an ionic bond. Many sodium and chloride ions are held together this way, resulting in a salt with a distinctive crystal shape. The three-dimensional arrangement or crystal lattice of ions in sodium chloride is such that each Na+ is surrounded by six anions (Cl-) and each Cl-is surrounded by six cations (Na+). Thus the ionic compound has a balance of oppositely charged ions and the total positive and negative charges are equal.