Even though emissions of carbon dioxide warm the lower atmosphere, they have the opposite effect on the upper atmosphere. The reason has to do with the difference in density. Near the Earth's surface, carbon dioxide absorbs radiation escaping Earth, but before it can radiate the energy to space, frequent collisions with other molecules in the dense lower atmosphere force the carbon dioxide to release energy as heat, thus warming the air. In the much thinner thermosphere, a carbon dioxide molecule absorbs energy when it collides with an oxygen molecule, but there is ample time for it to radiate energy to space before another collision occurs. The result is a cooling effect.