Short-wavelength Infra-red radiation from the sun reaches the Earth, some is reflected by the atmosphere, most reaches the surface, the energy is absorbed and re-emitted as longer-length IR radiation, mostly absorbed by the atmosphere (greenhouse gases, CO2 etc.) and keeps the Earth warm