While most igneous rocks are formed from magma that cools and solidifies beneath the Earth's surface (intrusive igneous rocks), there's another category: extrusive igneous rocks.
Extrusive igneous rocks are formed from lava that erupts onto the Earth's surface and then cools and solidifies. So, while their origins lie within the Earth, their final formation happens on the surface.
Here's a breakdown:
* Intrusive Igneous Rocks: Formed from magma cooling and solidifying *inside* the Earth. Examples: granite, gabbro
* Extrusive Igneous Rocks: Formed from lava cooling and solidifying *on* the Earth's surface. Examples: basalt, rhyolite, obsidian
Therefore, it's not accurate to say that *all* igneous rocks are formed inside the Earth. Some form on the surface, making their formation a combination of processes both inside and outside the Earth.