Atmospheric gases are lost to space when the individual molecules' thermal motion exceeds the escape velocity of the body. Since a gas at any particular temperature will have molecules moving at a wide range of velocities, there will almost always be some slow leakage of gas into space. Lighter molecules move faster than heavier ones with the same thermal kinetic energy, and so gases of low molecular weight are lost more rapidly than those of high molecular weight. It is thought that Venus and Mars may have both lost much of their water when, after being photodissociated into hydrogen and oxygen by solar ultraviolet, the hydrogen escaped. Earth's ozone layer helps to prevent this.
See also: Earth's atmosphere, stellar atmosphere\n