Air is a mixture of gasses that compose the atmosphere. When the earth was forming, air as we know it today did not exist. In the beginning of the earth’s formation, gravity drew in materials that were orbiting around the sun. This included gases.
Early attracted gases were probably helium and hydrogen. Both are light gases, and it is thought that gravity at that time was not strong enough to hold them around the earth. As a result, there are smaller amounts of these gases in the air today in comparison to the larger amounts found throughout the universe.
As the earth cooled, the solid inner core and liquid outer core produced the magnet field.
When the heat of the early earth during the Archean eon (the earliest eon of geologic time, dating from about four billion years ago) dissipated out into space, water began to condense, and surface water accumulated.
Early oxygen levels were at around 1 to 2 percent of what they are today. Ozone (O3) formed to protect the earth from ultraviolet light.
It is thought that the small amount of oxygen--1 to 2 percent--was taken up in the weathering process of rocks. Once the surface was oxidized, oxygen would remain in the atmosphere.
Later in part of Precambrian time (the eon of geologic time, 2.5 billion to 570 million years ago, during which sea plants and animals first appeared) the oxygen level increased from 1 to 10 percent, mainly by the cyanobacteria. The growth of plant life then enabled the production of oxygen through the process of photosynthesis. Oxygen may also be produced from chemical reaction in ocean sediments.
Air currently varies from location to location due to humidity, ice crystals, sea salt crystals, ice crystals, small liquid droplets, small solid particles, dust, and volcanic emissions being dispersed throughout the air.
The multiple gases today are influenced by gravity, plant life and pollution.
Air is composed mainly of 78.09% nitrogen. It's made up of 20.95 percent oxygen with 1% consisting of 0.93% argon. There's 0.03% carbon dioxide and water vapor. Only about 0.003% consists of other trace gases such as ozone. Water vapor amounts in the air vary.