Magma contains dissolved gases that are released into the atmosphere during eruptions. Gases are also released from magma that either remains below ground (for example, as an intrusion) or is rising towards the surface. In such cases, gases may escape continuously into the atmosphere from the soil, volcanic vents, fumaroles, and hydrothermal systems.
The major volcanic gases emitted from basaltic magma are H2O, CO2, SO2, H2, CO, H2S, HCl and HF. The most abundant gas is water vapor (H2O), followed by carbon dioxide (CO2) and sulfur dioxide (SO2).
Volcanic gas hazard (pdf file)