An atom by itself generally has a neutral charge, because the positive charge from the protons in its nucleus is balanced by the negative charge of its electrons. However, when many types of atoms come into contact with one another, electrons can be transferred from one atom to another. A negative ion is created when one atom gains electrons. Conversely, a positive ion is created when an atom loses electrons. The oppositely charged ions attract one another, creating an ionic bond, and a neutrally charged compound.
An everyday example of an ionic compound is table salt—sodium chloride (NaCl). Table salt is actually a lattice, or network, of sodium and chloride ions joined together with ionic bonds.
According to the atomic model, electrons orbit the nucleus at specific levels, or shells. Electrons fill shells, starting from the innermost, going to the outermost. Atoms are more stable when their outer shell is filled, and therefore, atoms will lose, gain, or share electrons to complete their outer shells. Electrons in the outermost shell, which are involved in bonding, are known as valence electrons.
When two atoms vary significantly in electronegativity (the measure of the ability of atoms to attract electrons), they tend to form ionic bonds. Some atoms tend to lose electrons, while others are more likely to gain them. Elements with low electronegativity, such as metals, have outer shells that are almost empty and give up electrons fairly easily. Elements with high electronegativity, such as nonmetals, have outer shells that are mostly full and tend to hold on to their electrons. In general, elements on the left of the periodic table have low electronegativities, whereas elements on the right side of the periodic have high electronegativities.
Sodium has relatively low electronegativity, with only one electron in its outer shell. With most of its outer shell full, chlorine has relatively high electronegativity and needs only one extra electron to fill its shell. When sodium and chlorine atoms come together, the sodium atom lends its outer electron to the chlorine atom. The positively charged sodium ion is then attracted to the negatively charged chloride ion and creates an ionic bond.
When atoms have similar electronegativity, a covalent bond forms. Covalent bonds differ from ionic bonds in that instead of transferring electrons, the atoms share electrons.