Ionisation energy:
Ionisation energy is the minimum energy necessary to remove an electron from an isolated gaseous atom in its ground state to generate a cation. It's also known as ionisation enthalpy.
It's expressed in kJ/mol. Greater the ionisation energy, it is more difficult to remove the electron.
Since the atomic size decreases from left to right in a period, more energy is needed to remove the electrons. Thus, the ionisation energy increases through the period. Yet, down the group, the atomic size increases and hence the valence electrons are loosely bound. They need relatively less energy for the removal. Thus, ionization energy decreases down the group in the periodic table.
Electron affinity:
The amount of energy liberated when an isolated gaseous atom gains an electron to form its anion is known as electron affinity.
  • It is also expressed in kJ/mol and has the following equation:
\(A_(g)\) + \(e^-\) → \(A^-{_(g)}\) + Energy
\(Cl_(g)\) + \(e^-\) → \(Cl^-{_(g)}\) + Energy
Electron affinity, like ionisation energy, increases from left to right in a period and decreases from top to bottom in a group.