The Earth's early atmosphere was probably formed from gases given out by volcanoes. These gases included a large amount of carbon dioxide, little or no oxygen, and small amounts of other gases, such as ammonia, methane, water vapour, and probably nitrogen.
The water vapour condensed to form oceans. The water began dissolving gases such as ammonia, creating nitrogen containing substances and ammonia compounds. Nitrogen from volcanic activity was probably stored in the atmosphere because it is so unreactive.
The atmosphere today
2.7 billion years ago, plants and algae began to build up in the oceans, and carbon dioxide decreased in the atmosphere because it was being used in photosynthesis. Oxygen was released from the plants and entered the atmosphere.
Our negative impacts
Oxygen being present in the atmosphere enabled animals to evolve, putting carbon dioxide back into the air so it could be used in photosynthesis. The ozone layer stopped lots of UV light getting through, so land animals and plants could form.
Today, the atmosphere is 78% nitrogen, 21% oxygen, less than 1% carbon dioxide, and other gases such as argon, methane, and water vapour.
Today we burn fossil fuels, increasing the carbon dioxide levels in the atmosphere faster than it can be removed. We keep cutting down trees and killing plants, decreasing the amount of carbon dioxide being used in photosynthesis.