What happens to a chocolate bar when it gets very hot? It melts.
The same thing happens to a rock when it is heated enough. Of course, it takes a lot of heat to melt a rock. The high temperatures required are generally found only deep within the earth. The rock is pulled down by movements in the earth's crust and gets hotter and hotter as it goes deeper. It takes temperatures between 600 and 1,300 degrees Celsius (1,100 and 2,400 degrees Fahrenheit) to melt a rock, turning it into a substance called magma (molten rock).
What would you do to turn a melted chocolate bar back into a solid? You'd cool it by putting it into the refrigerator until it hardens.
Similarly, liquid magma also turns into a solid — a rock — when it is cooled. Any rock that forms from the cooling of magma is an igneous rock. Magma that cools quickly forms one kind of igneous rock, and magma that cools slowly forms another kind.
When magma rises from deep within the earth and explodes out of a volcano, it is called lava, and it cools quickly on the surface. Rock formed in this way is called extrusive igneous rock. It is extruded, or pushed, out of the earth's interior and cools outside of or very near the earth's surface.
What if the magma doesn't erupt out of a volcano, but instead gets pushed slowly upward toward the earth's surface over hundreds, thousands, or even millions of years? This magma will also cool, but at a much slower rate than lava erupting from a volcano. The kind of rock formed in this way is called intrusive igneous rock. It intrudes, or pushes, into the earth's interior and cools beneath the surface.