The trapping of heat by carbon dioxide and water vapor in the atmosphere is called the greenhouse effect. Clouds also have an effect in keeping the earth's surface warm. Clouds increase the greenhouse effect by absorbing some of the infrared radiation that would normally be lost into space. The clouds radiate some of the heat back to the surface. Water vapor in clouds absorbs infrared radiation and radiates the heat back to the earth's surface.
Air also cools as heat radiates from it into space.
For example, air cools more quickly on clear nights than on cloudy nights. Clouds trap heat and keep it from radiating into space. On clear nights, the infrared that the earth radiates can escape into space. Clouds play an important part in the water cycle, and therefore the climate of a region. The earth's water is continuously changing forms through evaporation and condensation.