There are three ways in which magma can be formed; through heat transfer, decompression melting and flux melting.
1. Heat transfer is the process in which a rising column of magma sends heat from it to the surrounding rock around it, causing it to be pushed beyond melting point and creating rhyolitic magma.
2. Decompression melting, occurs when two separate tectonic plates begin to or have already separated, which causes the mantle below it to rise up between them. Once pressure begins to drop, the raised-up mantle begins to melt into magma.
3. Flux melting will occur when volatile matter, such as sulfur gases and water, is stirred into the body of the rock. This process typically precludes the creation of volcanic arcs and magma.