The greenhouse effect is a warming of the Earth’s surface and troposphere (the lowest layer of the atmosphere) caused by the presence of water vapour, carbon dioxide, methane, and certain other gases in the air. Of those gases, which are known as greenhouse gases, water vapour has the greatest effect.

Greenhouse effect on Earth

Some incoming sunlight is reflected by the Earth's atmosphere and surface, but most is absorbed, which then warms the surface. Infrared (IR) radiation is then emitted from the surface. Some IR radiation escapes to space, but some is absorbed by the atmosphere's greenhouse gases (especially water vapour, carbon dioxide, and methane) and reradiated in all directions. The IR radiation reradiated back towards the surface further warms it and the lower atmosphere. Encyclopædia Britannica, Inc.

https://www.britannica.com/science/greenhouse-effect