Start with the group number
Many main-group elements form predictable ions. Group 1 elements usually form +1 ions, Group 2 elements usually form +2 ions, oxygen commonly forms -2, and halogens commonly form -1.
Check whether it is a transition metal
Transition metals often have more than one possible charge. Iron can be Fe2+ or Fe3+, copper can be Cu+ or Cu2+, and tin can be Sn2+ or Sn4+.
Use the compound name
Roman numerals show the charge for many transition metals. Iron(III) means Fe3+. Copper(II) means Cu2+.
Balance the total charge
An ionic compound should have a total charge of zero. For example, Mg2+ and O2- make MgO. Al3+ and Cl- make AlCl3.