|This article does not cite any references or sources. (December 2009)|
A magma chamber is a large underground pool of liquid rock found beneath the surface of the Earth. The molten rock in such a chamber is under great pressure, and given enough time, that pressure can gradually fracture the rock around it creating outlets for the magma. If it finds a way to the surface, then the result will be a volcanic eruption; consequently many volcanoes are situated over magma chambers. Magma chambers are hard to detect, and most of the known ones are therefore close to the surface of the Earth, commonly between 1 km and 10 km under the surface. In geological terms this is extremely close to the surface, although in human terms it is considerably deep underground.
Dynamics of magma chambers 
Magma rises through cracks from beneath the crust because it is less dense than the surrounding rock. When the magma cannot find a path upwards it pools into a magma chamber. As more magma rises up below it, the pressure in the chamber increases.
If magma resides in a chamber for a long period, then it can become stratified with lower density components rising to the top and denser materials sinking. It can also start to cool, with the higher melting point components such as olivine crystallizing out of the solution, particularly near to the cooler walls of the chamber, and forming a denser conglomerate of minerals which sinks. Any subsequent eruption may produce distinctly layered deposits, for example the deposits from the 79 AD eruption of Mount Vesuvius include a thick layer of white pumice from the upper portion of the magma chamber overlayed with a similar layer of grey pumice produced from material erupted later from lower down in the chamber.
Another effect of the cooling of the chamber is that the solidifying crystals will release the gas (primarily steam) previously dissolved when they were liquid, causing the pressure in the chamber to rise, possibly sufficiently to produce an eruption. Additionally, the removal of the lower melting point components will tend to make the magma more viscous (by increasing the concentration of silicates). Thus, stratification of a magma chamber may result in an increase in the amount of gas within the magma near the top of the chamber, and also make this magma more viscous; potentially leading to a more explosive eruption than would be the case had the chamber not become stratified.
Often, a volcano may have a deep magma chamber many kilometres down, which supplies a shallower chamber near the summit. The location of magma chambers can be mapped using seismology: seismic waves from earthquakes move more slowly through liquid rock than solid, allowing measurements to pinpoint the regions of slow movement which identify magma chambers.
As a volcano erupts, emptying the magma chamber, the surrounding rock will collapse into it. If a large amount of magma is erupted, causing the chamber to reduce considerably in volume, then this can result in a depression at the surface called a caldera.