Some volcanic eruptions are explosive because of the mixing between water and magma reaching the surface, which releases energy suddenly. However, in some cases, the eruption is caused by volatiles dissolved in the magma itself. Approaching the surface, pressure decreases and the volatiles come out of solution, creating bubbles that circulate in the liquid. The bubbles become connected together, forming a network. This promotes the fragmentation into small drops or spray or coagulate clots in gas.
Generally, 95-99% of magma is liquid rock. However, the small percentage of gas present represents a very large volume when it expands on reaching atmospheric pressure. Gas is thus important in a volcano system because it generates explosive eruptions. Magma in the mantle and lower crust has a high volatile content. Water and carbon dioxide are not the only volatiles that volcanoes release; other volatiles include hydrogen sulfide and sulfur dioxide. Sulfur dioxide is common in basaltic and rhyolite rocks. Volcanoes also release a large amount of hydrogen chloride and hydrogen fluoride as volatiles.