Global warming occurs when the Earth absorbs more heat from the sun than it radiates back out to space. The Earth releases heat through thermal radiation, emitting electromagnetic waves. Certain gases in the atmosphere like carbon dioxide and methane absorb some of the infrared wavelengths emitted by the Earth, trapping heat and preventing it from escaping. This causes the Earth's temperature to rise over time as the trapped heat accumulates in the lower atmosphere.