The first atmosphere of the Earth was very different from that of today. There was no free oxygen but high levels of carbon dioxide produced by continual volcanic eruptions. This provided the original green house effect, allowing the earth to be warmed by the trapped rays of Sun. By 1800 million years ago oxygen began to be produced by algae photosynthesizing, and first appeared in the atmosphere. The amount of oxygen continued to increase but was still probably only two thirds of the present level when the first animals appeared 670 million years ago. Only after the Ozone layer formed did it become safe for animals to leave the sea and respiration became mainly aerobic.
During the Mesozoic era there may have more oxygen than today as a result of algal blooms. It cannot have been more than about 24 percent or forest fires would have raged out of control. One theory suggests that dinosaurs achieved their large size thanks to abundant oxygen and became extinct when the levels fell. The other side of the story of increasing oxygen has been one of decreasing carbon dioxide. As the Sun warmed, life kept pace with it by consuming the green house gases and converting carbon dioxide into thick deposits of limestone, chalk and fossil fuels. Now humans are burning those fuels, releasing the carbon dioxide back in to the air. And the forests that recycle it back into oxygen and organic matter are being felled, so the green house effect is increasing. Various predictions suggest that average global temperatures could rise by several degrees as a result.