Here's how it forms:
1. Accumulation: Large amounts of plant matter, like trees, ferns, and mosses, accumulate in swampy areas with little oxygen.
2. Burial: Over time, layers of sediment bury the plant material, increasing the pressure and temperature.
3. Decomposition: Bacteria break down the plant matter, leaving behind carbon-rich material.
4. Transformation: With increasing pressure and heat, the carbon-rich material transforms into coal, going through various stages (peat, lignite, bituminous coal, and anthracite coal).
The type of coal depends on the pressure, heat, and time involved in the process.