Earth's Energy Balance
The First Law of Thermodynamics tells us energy can't be created nor destroyed, only changed or transferred from one form into another. If the amount of energy an object gains differs from the amount it loses, that object will change in temperature.
The Earth is in thermodynamic equilibrium with the sun. Earth absorbs energy from the sun in the form of short wave and ultraviolet electromagnetic radiation and emits energy back into space in the form of infrared radiation. This means if there is an energy imbalance so that the Earth emits less energy to space than it receives, it will increase in temperature.
When 100 units of energy emitted by the
sun reaches Earth's atmosphere, the energy is distributed as
shown in the figure below. On average 30 units of the sun energy
is reflected by clouds and Earth's surface, and around 45
units of sun energy directly reach Earth's surface. Note that
Earth's surface actually receives about twice as much energy
from the re-emission of infrared radiation due to greenhouse
gases and clouds in the atmosphere. Ideally, Earth balances the incoming energy by
emitting 70 units of infrared radiation energy back into
space.The extra energy emission in the atmosphere due to the
natural greenhouse gas effect is what keeps Earth a
habitable temperature.
Figure from: https://learner.org/courses/envsci/unit/text.php?unit=2&secNum=3