Protons have a positive charge and electrons have an equal and opposite negative charge. Atoms with unequal numbers of protons and electrons will have an electrical charge.
If a neutrally charged atom gains an electron it forms a negative ion, called a anion. (pronounced ænˌaɪən)
Losing an electron does the opposite, forming a positively charged ion, called a cation. (Pronounced kætˌaɪən)
The periodic table is useful in predicting the common ionic state for each element. Looking at the periodic table above we see that elements in the first column all form ions with a +1 charge. The second column has a charge of +2, and the pattern skips the elements in the "valley", but it continues with the column starting with B (boron). The pattern restarts and reverses starting with N (nitrogen), and counts backwards but with negative charge.
Similar to magnets opposite poles, one properties of charge is that opposites attract. Atoms with positive charge will be attracted to atoms with a negative charge.
Sodium ions have 11 protons and 10 electrons giving them an overall positive charge of +1.
Chlorine ions have 17 protons and 18 electrons giving them an overall negative charge of -1.
The attraction between the opposite charges is what keeps sodium chloride, table salt, together as a solid.
Ionic bonds form Ionic compounds, also known as salts. In general, ionic compounds have relatively high melting points because the ionic bond is so strong. Salt has a melting point of 1,474°F. However, salts readily dissolve in water because the polar nature of water can stabilize the different charges.
A Salt Crystal Formation
Ionic compounds form a crystal lattice, a pattern of repeating atoms, because the positive charge must be surrounded by negative charge and visa versa. The shape of the crystal lattice can be seen if the crystal is large enough. Each ionic compound has a distinct crystal structure.
All ionic compounds are made of two parts: a cation (positive) and an anion (negative).
When naming an ionic compound you always write the name of the cation's element first. The anion comes second, but you change the ending to have "-ide" at the end.
Not all ions are made of a single atom. Some ions are made of multiple atoms and are called polyatomic ions. Here is a list of common poly atomic ions. For polyatomic ions do not add "-ide", but use the name as listed.
Writing ionic formulas from the names is a bit more tricky. Not only must you identify the correct elements, but you must also match them in the correct amounts.
Ionic crystals can be any size as long as the cation and anion are in the correct ratio to stabilize their charge. The ratio always cancels out the charge of the individual ions so that the crystal has no net charge. For sodium chloride this lowest ratio is 1:1, one Na+ to one Cl- ion. The +1 charge of the Na ion cancels the -1 charge of the Cl ion.
So the chemical formula of sodium chloride is NaCl, also known as a formula unit.
For ions that are more difficult to guess their ratio we can use the criss-cross method. When looking for the lowest ratio we look for the lowest common multiple between the charges. We can find this by using the number in the charge as the subscript for the other ion.
Magnesium (Mg) ions have a +2 charge and bromine (Br) has a -1. In this case the lowest common multiple between 1 and 2 is 2. So two bromine ions are needed to cancel one magnesium ion. So the formula is MgBr2 . The subscript 2 means that there are two Bromine ions per formula unit.
Below are some more examples.