How did oil and coal actually form?
BLUF: Both are buried, transformed remains of once-living things. Coal formed from land plants that piled up in ancient swamps; oil and natural gas formed mostly from marine plankton and algae buried in seafloor mud. Heat, pressure, and millions of years did the rest.
Their biological origins explain both why these fuels pack so much energy and why burning them releases carbon that plankton and plants locked away hundreds of millions of years ago.
Two different recipes
Coal begins in wetlands. When trees, ferns, and mosses die in waterlogged swamps, a lack of oxygen slows decay, so plant matter accumulates as spongy peat. Sediment buries the peat, and over millions of years heat and pressure squeeze out water and volatile compounds, concentrating carbon. The peat hardens through increasing "ranks": lignite, then bituminous coal, and finally anthracite, the hardest and most carbon-rich. Oil and natural gas take a different path. Microscopic marine life, mainly plankton and algae, sinks to oxygen-poor seafloors and mixes with mud, forming organic-rich source rock. Buried deeper, that organic matter becomes a waxy substance called kerogen. In the "oil window," roughly 60 to 120 degrees Celsius, kerogen cracks into liquid petroleum; hotter and deeper still, it yields natural gas.
Stored sunlight, interrupted decay
The unifying idea is captured sunlight. Living things build their tissues using energy from photosynthesis, locking solar energy into carbon-rich molecules. Normally, when an organism dies, decomposers return that carbon to the air as carbon dioxide. Fossil fuels form only in the rare settings where decay is interrupted, such as stagnant swamps and oxygen-starved seabeds, so organic matter is buried before it can fully rot. Geology then acts as a slow oven: burial supplies the heat and pressure that concentrate carbon and hydrogen over millions of years. What makes these fuels so energy-dense is precisely this ancient chemistry. Burning them reverses in seconds a storage process that took geological ages, releasing the trapped solar energy, and the carbon, all at once.
Where the deposits sit today
Most of the world's coal formed during the Carboniferous and Permian periods, roughly 359 to 252 million years ago, when vast tropical wetlands blanketed the assembling supercontinent Pangaea. Many major oil source rocks date instead to warm stretches of the Jurassic and Cretaceous, when nutrient-rich seas teemed with plankton. Today the deposits are scattered unevenly, coal seams in Appalachia, China, and Australia, oil in the Middle East, Texas, and the North Sea, reflecting where ancient swamps and seas once lay. Oil rarely sits in open pools. It seeps upward through porous rock until an impermeable "cap rock" traps it, saturating tiny pores like water in a sponge. Extracting and burning these long-buried carbon stores is exactly what links their formation to modern climate change.
Common misconceptions
Myth: oil comes from dinosaurs. Reality: it forms mainly from microscopic marine plankton and algae, with dinosaurs contributing essentially nothing. Myth: coal and oil form the same way. Reality: coal comes from land plants in swamps, while oil and gas come from marine microorganisms in seafloor mud. Myth: oil collects in vast underground caverns or lakes. Reality: it is held in the tiny pore spaces of solid rock, like water soaked into a sponge. Myth: Carboniferous coal is so abundant simply because fungi had not yet evolved to rot wood. Reality: that popular idea is debated; a wet climate and sprawling lowland swamps during Pangaea's assembly likely mattered as much or more than any lag in decay.