Fossil fuels form from ancient living things—mostly tiny ocean plants and plankton—that died, sank into oxygen-poor mud, and were slowly cooked by heat and pressure underground over millions of years. The key condition is that the remains must be buried before they fully rot, so their carbon and energy get trapped instead of returning to the air. Coal comes mostly from land plants in swampy forests; oil and natural gas come mostly from marine plankton in shallow seas. None of this happens quickly: it is a geological process measured in millions of years, not a recipe you can repeat in a kitchen.

What Fossil Fuels Actually Are and Where the Energy Begins

Fossil fuels are energy-rich substances—coal, oil, and natural gas—made of carbon and hydrogen that originally came from sunlight. Plants and plankton capture sunlight through photosynthesis, storing that solar energy in their tissues. When they die and their remains are buried and transformed, the stored chemical energy survives in a concentrated form. Burning a fossil fuel releases that ancient sunlight as heat and light.

This is why fossil fuels are called "fossil": they are the altered remains of once-living organisms. The energy is not magic and it is not created underground. It is recycled sunlight, captured by living things long before humans existed, then locked away by geology.

For children, the simplest idea is a bank account. Living things "deposit" sunlight into their bodies. Burial "freezes" the account so it cannot be spent by decay. Millions of years of heat and pressure "convert" the deposit into a concentrated fuel. When we burn it, we make a withdrawal of energy that was saved ages ago.

The Two Main Pathways: Coal Versus Oil and Gas

Coal and petroleum (oil plus natural gas) follow different routes because they start with different raw materials and different burial conditions.

Coal begins with land plants—giant ferns, horsetails, and early trees—that grew in warm, waterlogged swamps. When they died, they fell into stagnant water where oxygen was scarce. Layer upon layer of plant material piled up as peat. As more sediment covered the peat, water was squeezed out, and heat and pressure gradually transformed it into progressively harder, more carbon-rich coal: peat, then lignite, then sub-bituminous and bituminous coal, and finally anthracite. Higher heat and longer burial push coal further along this sequence.

Oil and natural gas begin mostly with marine plankton—microscopic algae and bacteria—that lived in shallow seas. When they died, they sank into fine mud on the seafloor. In oxygen-poor bottom water, they did not fully decompose. Buried under more sediment, this organic-rich mud became a waxy, kerogen-bearing rock called source rock. As burial deepened, rising temperature "cooked" the kerogen, first releasing oil and later natural gas.

The table below compares the two pathways using matched outcomes.

Feature Coal pathway Oil and gas pathway
Main raw material Land plants (ferns, trees) Marine plankton and algae
Setting Swampy forests, coastal plains Shallow seas, fine mud seafloor
Key intermediate Peat Kerogen in source rock
Burial condition Waterlogged, low oxygen Low-oxygen seafloor mud
Main product Coal Oil and natural gas
Typical dominance Where plant beds were thick Where plankton-rich mud was thick

Step by Step: The Burial and "Cooking" Process

The formation of oil and gas, the best-studied case, follows a recognizable sequence that geologists describe in stages. It is not a guaranteed schedule—temperatures and burial rates vary—but the general order is well supported.

The process has these parts:

Accumulation: dead plankton settle into fine sediment in oxygen-poor water, so decay is limited. Preservation: more sediment buries the organic-rich layer, sealing it from oxygen and microbes. Diagenesis: shallow burial and mild heat convert the organic matter into kerogen, a solid waxy substance in the rock. Catagenesis (the oil window): at greater depth and higher temperature, kerogen breaks down into liquid oil and some gas. Metagenesis: deeper and hotter still, oil cracks into natural gas, and finally only dry gas and carbon residue remain.

The "oil window" is a temperature range, roughly 60–150 °C (about 140–300 °F), where liquid oil forms most abundantly. Below it, the kerogen is not cooked enough; above it, oil is destroyed and gas dominates. Natural gas can form across a wider, hotter range, extending well beyond the oil window. These are approximate ranges that depend on the type of organic matter and burial history.

An illustrative timeline of the geological time course, using typical progress rather than a fixed schedule:

Stage Approximate depth Approximate temperature What forms
Peat or organic mud Near surface Ambient Unaltered remains
Kerogen formation Hundreds of meters Mild, below ~60 °C Waxy kerogen
Oil generation 2–4 km ~60–120 °C Liquid oil
Wet gas generation Deeper ~120–150 °C Oil plus gas
Dry gas generation Deepest Above ~150–200 °C Mostly methane

Depths and temperatures overlap and shift with local geology. The numbers are illustrative ranges from general petroleum geoscience, not measurements of any single deposit. They are useful because they show that "cooking" is a matter of degree: the same organic matter gives different products depending on how deep and how hot it gets.

Why Oxygen Matters, and What Changes When It Is Present

The single most important condition for fossil fuel formation is limited oxygen. Where oxygen is plentiful, microbes break down dead organisms completely, turning carbon back into carbon dioxide and water. That returns the carbon to the atmosphere and destroys the stored energy. No concentrated fuel remains.

Where oxygen is scarce—stagnant swamp water, oxygen-poor seafloor mud—decomposition slows dramatically. The organic matter survives long enough to be buried. Once buried, it is protected from further oxygen exposure, and the slow geological cooking can begin.

This explains a counterintuitive detail: a warm, lush, productive environment is not enough on its own. The remains must also end up in a place where oxygen cannot reach them quickly. A rotting log in a well-aerated forest returns its carbon to the air; the same plant material in a waterlogged bog can become peat, the first step toward coal.

Conditions change the outcome in predictable directions. Faster burial preserves more organic matter because it escapes the oxygen-exposed surface sooner. Higher heat speeds up the cooking but also pushes products toward gas and eventually destroys hydrocarbons. Lower heat leaves the material as kerogen or peat. The type of starting material shifts the balance between coal and petroleum.

Migration, Traps, and Why Fuels Are Found Where They Are

Forming oil and gas is only half the story. Once generated, oil and gas are buoyant and tend to migrate upward through porous rock, away from the hot source rock. They move until they hit an impermeable layer—a "trap"—that stops them. A trap might be a folded rock arch, a fault, or a salt dome. The fuel accumulates in the pore spaces of a reservoir rock, such as sandstone or limestone, beneath the sealing layer.

This is why oil and gas are often found far from where they formed, and why exploration looks for traps and seals, not just source rock. Coal behaves differently: it stays roughly where the plant material accumulated, so coal seams are found within the sedimentary rock layers that buried the ancient swamp.

A common misconception is that oil forms in underground "pools" or "caverns." In reality, oil and gas sit in tiny pores within rock, like water in a sponge. Another misconception is that fossil fuels are still forming quickly today. Small amounts of peat and organic-rich mud are accumulating now, but the deep cooking takes millions of years. What we burn is largely a legacy of ancient geological eras.

What This Means in Practice and the Limits of the Explanation

Understanding formation helps explain why fossil fuels are found in specific regions with the right geological history: ancient swamp basins for coal, and organic-rich marine sedimentary basins with traps for oil and gas. It also explains why fossil fuels are finite on human timescales. The formation rate is geological, while the consumption rate is human, so the two are wildly out of balance. That imbalance underpins much of the energy and climate discussion around fossil fuels.

Practical actions for learners rest on the prerequisites above. To check understanding, a child can model burial with layers of sand, mud, and plant material in a clear container, observing that sealed, waterlogged layers change slowly while open layers rot. Observable success is that the sealed layer retains more visible plant material and color after weeks. The main failure conditions are oxygen exposure and disturbance, which cause decay and mixing—exactly what formation must avoid. Such a model illustrates preservation only; it cannot simulate the temperatures and timescales of real cooking.

The limitations are important. Formation models compress complex geology into simple ranges, and real deposits vary widely in temperature, pressure, organic input, and burial history. The oil-window and gas-window ranges are general guides, not universal constants. No single experiment or model can recreate millions of years of burial, so the explanation remains a well-supported reconstruction rather than a directly observed event.

A professional caveat worth stating plainly: calling fossil fuels "fossils" is a helpful shorthand, but they are chemical transformation products of ancient life, not preserved bones or shells. The energy they hold traces back to sunlight, captured by living things, preserved by burial, and concentrated by heat and pressure over geological time.