While ionization energy measures how hard it is to pull an electron away, electron affinity (EA) measures how eagerly an atom welcomes one in. Formally, it is the energy change when a neutral gaseous atom gains an electron to form an anion: X + e⁻ → X⁻. When energy is released (an exothermic process), the electron affinity is reported as a positive value by convention, meaning the atom is "happy" to accept the electron. Chlorine has the highest electron affinity of any element at 349 kJ/mol — its seven valence electrons are desperate for an eighth to complete the octet, and gaining that electron releases a significant burst of energy.
The periodic trends for electron affinity are less smooth than those for ionization energy, but the general pattern holds. Electron affinity tends to increase across a period from left to right, peaking at the halogens (Group 17), because atoms closer to a full outer shell gain more stability by adding an electron. It generally decreases down a group because the added electron enters a shell farther from the nucleus, where attraction is weaker. Noble gases have essentially zero or negative electron affinities — their shells are already full, so adding an electron would require opening a new, higher-energy shell. There are notable exceptions: nitrogen has a surprisingly low EA (nearly zero) because its half-filled 2p subshell is unusually stable and resists disruption.
Electron affinity is closely related to electronegativity but is not the same thing. Electronegativity describes an atom's ability to attract electrons within a bond, while electron affinity is a measurable property of a free atom. Together, they explain why halogens dominate the right side of the periodic table as electron-grabbers: fluorine is the most electronegative element, but chlorine actually has a higher electron affinity because fluorine's tiny size creates electron-electron repulsion in its compact 2p orbitals. This subtle distinction matters in understanding reactivity — it is why chlorine, not fluorine, is used in industrial processes where controlled electron transfer is needed.