According to MOT (molecular orbital theory) oxygen (at. no. 8) has the following orbital configuration O2(16e−)=σ1s2σ∗1s2σ2s2σ∗2s2σ2pz2 (π2px2π2py2)π∗2px1π∗2py1
As oxygen has got two unpaired electrons, it is paramagnetic.
The sequence of energies of homonuclear diatomic molecule (except O2 and F2 ) is as follows σ1s<σ∗1s<σ2s<σ∗2s <[ππ2px2py]<σ2pz<[π∗π∗2px2py]<σ∗2pz
For oxygen and fluorine σ1s<σ∗1s<σ2s<σ∗2s<σ2pz <[ππ2px2py]<[ππ2px2py]<σ∗2pz