The first ionisation energy varies predictably across the periodic table. As we move from left to right across a period, the ionisation energy of elements increases. This is due to the decrease in the size of atoms across a period. The valence electrons get closer to the nucleus of an atom as we move from left to right due to increased nuclear charge. The force of attraction between the nucleus and the electrons increases and hence more energy is required to remove an electron from the valence shell. Ionisation energy of boron being unexpectedly less than that for beryllium due to the 2s orbital being totally filled in beryllium, whereas boron has one electron in a 2p orbital as well, and the 2s orbital is shielded much more than the 2p orbital. Ionisation energy is more for nitrogen than oxygen because nitrogen is more stable due to its half-filled electronic configuration.
Li<B<Be<C<O<N<F