The given formula is the integral of the Planck photon distribution. Set
Then
where
Each photon of frequency has energy , so the energy density is
This is the temperature scaling of thermal photon number and energy densities.
After decoupling, cosmological redshift gives
The occupation number is conserved along the freely propagating photon trajectory. Its exponential argument at decoupling becomes
Thus the spectrum still has the Planck form if
Frequency and temperature redshift by the same factor, which is the redshift preservation of a thermal photon spectrum.