An atom has equal numbers of protons and electrons, so it has no overall charge. When an atom loses or gains electrons, it becomes an ion: a positive ion, or cation, if it loses electrons, and a negative ion, or anion, if it gains them.
A sodium atom (2, 8, 1) loses its single outer electron and becomes a sodium ion, \mathrm{Na^+}, with the same arrangement as neon. A magnesium atom loses two electrons and becomes \mathrm{Mg^{2+}}.
A chlorine atom (2, 8, 7) gains one electron and becomes a chloride ion, \mathrm{Cl^-}, with the same arrangement as argon. An oxygen atom gains two electrons and becomes an oxide ion, \mathrm{O^{2-}}.
The charge of a simple ion can usually be read from the group of its element. Elements in groups 1, 2 and 13 lose 1, 2 and 3 electrons, while those in groups 15, 16 and 17 gain 3, 2 and 1.
Transition elements often form more than one ion. Iron, for example, forms both \mathrm{Fe^{2+}} and \mathrm{Fe^{3+}}.
Some ions are made of several atoms bonded together, such as the ammonium ion \mathrm{NH_4^+}, the hydroxide ion \mathrm{OH^-}, the nitrate ion \mathrm{NO_3^-}, the sulfate ion \mathrm{SO_4^{2-}} and the carbonate ion \mathrm{CO_3^{2-}}. These are called polyatomic ions.
The energy needed to remove one electron from an atom in the gas state is called the first ionization energy. The smaller it is, the more easily the atom forms a positive ion.
Plotted against atomic number, the first ionization energy reaches a peak at each noble gas and drops sharply at the alkali metal that follows it.
Within a period it generally rises from left to right, because the growing charge of the nucleus holds the outer electrons more tightly. Down a group it falls, because the outer electrons are farther from the nucleus.
When an atom in the gas state gains an electron, energy is usually released. This energy is called the electron affinity, and the larger it is, the more easily the atom forms a negative ion.
The halogens in group 17 have the largest electron affinities, because gaining one electron gives them the same arrangement as a noble gas.
Chlorine releases even more energy than fluorine. A fluorine atom is so small that an incoming electron is pushed back by the electrons already crowded into its outer shell.
A positive ion is smaller than its atom. When a sodium atom becomes \mathrm{Na^+}, it loses its whole outer shell, so its radius shrinks sharply.
A negative ion is larger than its atom, because the added electron repels the other electrons and the electrons spread out.
The ions \mathrm{O^{2-}}, \mathrm{F^-}, \mathrm{Na^+}, \mathrm{Mg^{2+}} and \mathrm{Al^{3+}} all have the same arrangement of electrons as neon. The more protons the nucleus has, the more strongly it pulls these electrons in, so the ions get smaller in this order.