Earth’s surface gravity is strong enough to hold on to an atmosphere of gaseous material. The density of the atmosphere decreases with altitude, but never goes all the way to zero as it eventually merges with the very low density solar wind that blows through interplanetary space. However, 75% of the mass of Earth’s atmosphere is within an average height of 13 km, the bottom layer of the atmosphere known as the troposphere. 99.99997% of the atmospheric mass is within 100 km. This height is usually considered the boundary between Earth and space. 

Earth’s atmosphere is composed mostly of nitrogen (78%) and oxygen (21%), with smaller amounts of argon (0.93%), water vapor (0.25%), and carbon dioxide (0.04%). 

When Earth first formed it most likely had no atmosphere, as it would have been too hot. The atmosphere and ocean most likely accumulated from the combination of volcanic eruptions releasing trapped gas from Earth’s interior and impacts from asteroids and comets rich in water and other volatile compounds. The early atmosphere was probably composed of mostly nitrogen and carbon dioxide. The carbon dioxide concentration would decrease as the water ocean grew. Carbon dioxide dissolves into water and then combines to form carbonaceous rock. There would have been very little free oxygen at the time, since it is highly reactive and chemically combines with other materials quickly. Sometime before 2 billion years ago, photosynthetic bacteria in the oceans invented a new type of photosynthesis with a byproduct of free oxygen. These bacteria were so successful that they began a huge build up of oxygen in the atmosphere. This drastic change in atmospheric composition created mass extinctions of other organisms, but also led to the development of eukaryotic cells, capable of using the oxygen for energy. This innovation likely led to the eventual development of multicellular organisms. 

Earth’s atmosphere is warmed by the Sun. High energy ultraviolet and x-ray light have enough energy to ionize gas particles at the top of the atmosphere. This effectively shields the surface of the planet from these dangerous parts of the electromagnetic spectrum and creates a layer of ionized particles at the top of the atmosphere called the ionosphere. It is thicker on the day side of the Earth and relatively thin on the night side, since most ionizing radiation from space comes from the Sun, but there are astronomical sources as well.   

Some ultraviolet light gets deep enough into the atmosphere to encounter ozone (O3), which absorbs most of the remaining ultraviolet light, though not all. Some UV still makes it to the surface. Some of that ultraviolet light encounters water vapor in the atmosphere and breaks it apart into oxygen and hydrogen. Hydrogen is so light that at the typical temperatures on Earth it moves too quickly to be bound by Earth’s gravity. Most of this hydrogen created by the UV light breakup of water molecules extends far out in an envelope around the Earth called the exosphere.

About half of the visible light from the Sun and space makes it through the atmosphere. The other half is absorbed by the atmosphere or reflected back into space. This light heats up the surface.

Much of the infrared light from the Sun and space does not make it through the atmosphere to the ground. Water vapor, carbon dioxide, and other gases absorb the infrared light and heat up. 

When the surface of the planet is heated by visible light from the Sun it begins to glow in infrared light and tries to cool off by radiating that energy back into space. But the same compounds in the atmosphere that absorbed incoming infrared light (CO2, water vapor, etc) also absorb the outgoing infrared. This further heats the atmosphere which then radiates that energy back at the surface and out into space. This causes Earth to have a warmer temperature than it would otherwise have without an atmosphere. It is called the greenhouse effect in analogy to how greenhouses stay warm by letting sunlight in through glass, but not allowing the air inside to cool by mixing with the outside air. 

The surface temperature of Earth changes with the changing composition of its atmosphere. This happens naturally, and in the past 150 years it has been occurring quite rapidly due to human activity. Humans have been burning fuels that release large amounts of carbon dioxide into the atmosphere. This carbon dioxide was removed from the atmosphere over millions of years and is now suddenly getting put back into the atmosphere in very short order, creating a rapid climate change. 

Climate is the average temperature of a region over long periods of time. This varies on an annual basis due to the seasonal change in solar heating caused by the tilt of Earth’s axis. On a daily basis conditions can change due to currents in the atmosphere and ocean that transport heat energy around the planet. We call this short term variation in local climate conditions weather.   


the blackness of outer space is seen above a thin haze of blue above the surface of the Earth
This image of Earth from aboard the International Space Station illustrates that only a thin layer of atmosphere separates the surface from the emptiness of outer space. Image Credit: NASA
Earth's layers of the atmosphere.
The atmosphere has several layers of different temperature, density, and composition. 75% of the mass of the atmosphere is within the bottom layer, the troposphere. 99.99997% of the atmospheric material is within the mesosphere and below. The ionosphere shares space with the mesosphere and the thermosphere.
a diagram showing how much of the Sun's light is absorbed, reflected, and reradiated back into space.
Light from the Sun heats Earth. Some is reflected back into space, and the rest is absorbed by the atmosphere and the surface. The heated material radiates that energy back into space. But, "greenhouse" gases in the atmosphere trap some of that outgoing energy, further heating the planet's surface and atmosphere.