The gas best suited to absorbing ultraviolet light is ozone. Ozone is produced naturally in the Earth's stratosphere and protects it from harmful UV light. Ozone is made up of three oxygen atoms and, when hit by UV light, is converted to two oxygen atoms.
The ozone gas layer in the stratosphere is important because overexposure to ultraviolet light and other forms of short-wave radiation is detrimental to the Earth. Depletion of the ozone layer is due to many factors, including man-made chemicals and also aerosols, such as dust and smoke from volcanic activity. Other gases in the atmosphere are not as effective as ozone in absorbing UV light specifically.