Our atmosphere is about 78% nitrogen and 21% oxygen, with traces of other things like water and carbon dioxide. It’s an odd mix compared to the atmospheres of other planets. Jupiter and Saturn are dominated by hydrogen and helium, The thick atmosphere of Venus is about 96% carbon dioxide, and only 3% nitrogen, which is about the same ratio as the thin atmosphere of Mars. So why is our atmosphere so dominated by nitrogen?
It wasn’t always this way. Like most planets Earth’s earliest atmosphere was dominated by hydrogen and helium. These two elements are by far the most abundant in the Universe. About 92% of the atoms created by the big bang were hydrogen, and most of the rest were helium. All the other elements on the periodic table are formed through astrophysical processes such as nuclear fusion in the heart of a star. To this day they make up only a small trace of cosmic elements. When planets initially form, their composition is mostly hydrogen and helium. Some of the hydrogen bonds with other elements, but most of it remains free hydrogen. Both hydrogen and helium are light elements, so they will tend to evaporate into space over time. A large planet such as Jupiter has enough gravity to hold on to most of its hydrogen and helium, which is why these elements dominate the atmospheres of gas giants. But the gravity of Earth isn’t strong enough, so Earth’s early atmosphere of helium and free hydrogen evaporated into space.
Of the remaining elements, carbon, nitrogen, and oxygen are the most abundant. This is due to the fact that the main fusion reaction in large stars is the CNO cycle, which produces these elements as a by-product. These react easily with other elements, and produce gasses like water (H2O), carbon dioxide (CO2), and ammonia (NH3). Young Earth was much more geologically active than it is today, and volcanic activity released large quantities of these gases, and over time they came to dominate Earth’s atmosphere.
So why are the atmospheres of Venus and Mars dominated by CO2, while Earth’s is not? It all comes down to water. Earth’s vulcanism driven atmosphere was likely dominated by carbon dioxide like Venus and Mars, but Earth also has vast oceans of liquid water. Carbon dioxide dissolves easily in water, so our oceans absorbed much of the atmospheric CO2, leaving an atmosphere dominated by ammonia. It turns out that ammonia is unstable in Earth’s atmosphere. When struck by ultraviolet light from the Sun, it breaks apart into nitrogen and hydrogen. The liberated hydrogen evaporated into space, leaving nitrogen behind. Venus’ atmosphere likely followed a similar process, but without vast oceans to pull CO2 out of its atmosphere. While Venus’ atmosphere is mostly carbon dioxide, it is much thicker than Earth’s, and contains four times the nitrogen.
Even with it’s vast oceans, Earth’s atmosphere would likely have been dominated by carbon dioxide were it not for the appearance of life. Early cyanobacteria used sunlight and the carbon dioxide dissolved in Earth’s oceans to produce energy, and released oxygen as a by-product. Early oxygen bonded with iron to form a layer of rust, but eventually began to build up in Earth’s atmosphere. As carbon dioxide was broken down by cyanobacteria, more CO2 could be dissolved into the ocean. This gave rise to our modern atmosphere dominated by nitrogen and oxygen.