Cations are positively charged ions and anions are negatively charged ions. Metals act as cations and willingly give up or donate electrons to nonmetals. Nonmetals act as anions and accept donated electrons. Atoms are most stable when their outermost shell contains eight electrons. To achieve this, metals and nonmetals react with each other and form ionic bonds. This positive and negative attraction is what creates ionic compounds, explains Dummies.com
For every electron a cation donates, it receives a positive, or 1+, charge. For every electron an anion accepts, it receives a negative, or 1-, charge. The amount of electrons an atom is willing to donate or accept can often be determined by the element’s position on the periodic table. Group 1A contains alkali metals, which donate a single electron for a 1+ charge. The alkaline earth metals in group 2A lose two electrons for a 2+ charge. Aluminum loses three electrons for a 3+ charge. The transition metals, or B family members of the periodic table, can be more difficult to determine. Many of these elements can lose a varying number of electrons, so they can form two or more cation variants.
The number of electrons a nonmetal, or anion, is willing to accept is dependent on its number of valence electrons. Valance electrons are those in the atom's outermost shell, and atoms are most stable with a total of eight valence electrons. To achieve this, they accept the electron donated from cations. The halogens in group 7A of the periodic table have seven valence electrons. They accept one electron for a 1- charge. Group 6A anions accept two electrons for a 2- charge. Group 5A elements accept three electrons for a 3- charge. Elements in Group 8A are noble gases, and already have full valance electron shells and are therefore unreactive.