An atmosphere () is a layer of gas or layers of gases that envelop a planet, and is held in place by the gravity of the planetary body. A planet retains an atmosphere when the gravity is great and the temperature of the atmosphere is low. A stellar atmosphere is the outer region of a star, which includes the layers above the opaque photosphere; stars of low temperature might have outer atmospheres containing compound molecules.
The atmosphere of Earth is composed of nitrogen (78 %), oxygen (21 %), argon (0.9 %), carbon dioxide (0.04 %) and trace gases. Most organisms use oxygen for respiration; lightning and bacteria perform nitrogen fixation to produce ammonia that is used to make nucleotides and amino acids; plants, algae, and cyanobacteria use carbon dioxide for photosynthesis. The layered composition of the atmosphere minimises the harmful effects of sunlight, ultraviolet radiation, solar wind, and cosmic rays to protect organisms from genetic damage. The current composition of the atmosphere of the Earth is the product of billions of years of biochemical modification of the paleoatmosphere by living organisms.
The initial gaseous composition of an atmosphere is determined by the chemistry and temperature of the local solar nebula from which a planet is formed, and the subsequent escape of some gases from the interior of the atmosphere proper. The original atmosphere of the planets originated from a rotating disc of gases, which collapsed onto itself and then divided into a series of spaced rings of gas and matter that, which later condensed to form the planets of the Solar System. The atmospheres of the planets Venus and Mars are principally composed of carbon dioxide and nitrogen, argon and oxygen.
The composition of Earth's atmosphere is determined by the by-products of the life that it sustains. Dry air (mixture of gases) from Earth's atmosphere contains 78.08% nitrogen, 20.95% oxygen, 0.93% argon, 0.04% carbon dioxide, and traces of hydrogen, helium, and other "noble" gases (by volume), but generally a variable amount of water vapor is also present, on average about 1% at sea level.