Greenhouse gases in the earth’s atmosphere absorb IR from the sun and release it. Some of the heat released reaches the earth, along with heat from the sun that has penetrated the atmosphere. Both the solar heat and the radiated heat are absorbed by the earth and released; some is reabsorbed by greenhouse gases to perpetuate the cycle. The more of these gases that exists, the more heat is prevented from escaping into space and, consequently, the more the earth heats. This increase in heat is called the greenhouse effect.
Common examples of greenhouse gases, listed in order of abundance, include: water vapor, carbon dioxide, methane, nitrous oxide, ozone, and any fluorocarbons. Although water vapor is the most abundant greenhouse gas, it is a relatively ineffective one. Some degree of greenhouse gases in our environment is only natural -- without the greenhouse effect our ecosystem would not be possible.
Since the dawn of the industrial age in the 1750s, however, carbon dioxide alone has increased by 40%. Concerns about the greenhouse effect's contribution to global warming have prompted agreements between various governments on targets for reduction of greenhouse gas emissions.
While the same principle technically applies to an actual greenhouse, the effect is a small contributor to the structure’s total heat when compared with its prevention of heat loss through convection. In contrast, it is estimated that greenhouse gases, both natural and man-made, raise the average temperature of the earth by thirty-three degrees Celsius.
See a video explanation of the greenhouse effect: