The greenhouse effect is the process in which the emission of infrared radiation by the atmosphere warms a planet's surface.
The name comes from an analogy with the warming of air inside a greenhouse compared to the air outside the greenhouse.
The Earth's average surface temperature is about 33°C warmer than it would be without the greenhouse effect.
In addition to the Earth, Mars and especially Venus have greenhouse effects.
The Earth receives energy from the Sun in the form of radiation.
The Earth reflects about 30% of the incoming solar radiation.
The remaining 70% is absorbed, warming the land, atmosphere and oceans.
For the Earth's temperature to be in steady state so that the Earth does not rapidly heat or cool, this absorbed solar radiation must be very nearly balanced by energy radiated back to space in the infrared wavelengths.
Since the intensity of infrared radiation increases with increasing temperature, one can think of the Earth's temperature as being determined by the infrared flux needed to balance the absorbed solar flux.
The visible solar radiation mostly heats the surface, not the atmosphere, whereas most of the infrared radiation escaping to space is emitted from the upper atmosphere, not the surface.
The infrared photons emitted by the surface are mostly absorbed in the atmosphere by greenhouse gases and clouds and do not escape directly to space.
The reason this warms the surface is most easily understood by starting with a simplified model of a purely radiative greenhouse effect that ignores energy transfer in the atmosphere by convection (sensible heat transport) and by the evaporation and condensation of water vapor (latent heat transport).
In this purely radiative case, one can think of the atmosphere as emitting infrared radiation both upwards and downwards.
The upward infrared flux emitted by the surface must balance not only the absorbed solar flux but also this downward infrared flux emitted by the atmosphere.
The surface temperature will rise until it generates thermal radiation equivalent to the sum of the incoming solar and infrared radiation.