Oil forms through a chain of geologic processes that begins with massive amounts of microscopic marine life dying and settling on the seafloor, then being buried, compressed, and slowly cooked by Earth’s heat over millions of years. What starts as biological matter ends as the liquid hydrocarbons we pump from deep underground. Each step in this transformation requires specific conditions, and if any one of them is missing, oil never forms.
Where the Raw Material Comes From
The organic matter that eventually becomes oil originates primarily from tiny marine organisms: single-celled algae, plankton, and other microscopic life that flourished in ancient oceans. These organisms lived in vast numbers near the ocean surface, and when they died, their remains drifted downward and accumulated on the seafloor in layers mixed with fine-grained sediment like mud and silt.
Not all organic matter is equal when it comes to oil potential. Geologists classify the resulting material, called kerogen, into three types based on its biological source. Type I kerogen comes mainly from algae and is the most oil-prone. Type II comes primarily from plankton with some algal contribution, and it also generates oil effectively. Type III kerogen derives from land plants and tends to produce natural gas or coal rather than liquid oil. The richest oil source rocks typically contain Type I or Type II kerogen making up around 1% of the rock by weight.
Why Oxygen-Free Conditions Matter
For organic matter to survive long enough to become oil, it has to avoid being eaten by bacteria or broken down by oxygen. In most ocean environments, dead organisms decompose completely before they can be preserved. Oil formation requires something different: an oxygen-depleted, or anoxic, environment at the seafloor where decomposition is drastically slowed.
These conditions develop in specific settings. Coastal upwelling zones, restricted basins with poor water circulation, and warm shallow seas with stratified water columns all create environments where oxygen can’t reach the bottom sediments. In the ancient Tethys Ocean, for instance, warm greenhouse climates intensified evaporation, creating dense, salty bottom water that stayed separated from the oxygen-rich surface. This stratification kept oxygenated water away from the accumulating organic material on the seafloor.
Sedimentation rate also plays a role. Counterintuitively, a slow burial rate actually helps. Rapid burial dilutes the organic matter with too much mineral sediment, reducing the concentration of carbon in the rock. Slow, steady sedimentation in an anoxic setting produces the highest enrichment of organic material, creating what geologists call a source rock.
From Dead Organisms to Kerogen
Once buried under layers of sediment, the organic matter enters a transformation stage called diagenesis. At shallow depths and relatively low temperatures, bacteria go to work on the remains. In the absence of oxygen, anaerobic microbes break down some of the material into simple byproducts like methane and hydrogen sulfide. But the fraction that survives bacterial attack undergoes a different fate: the remaining organic molecules begin combining and rearranging, losing water and carbon dioxide in the process. What’s left is kerogen, a waxy, insoluble solid locked within the surrounding rock.
This stage happens at relatively shallow burial depths and low temperatures. The kerogen at this point is not yet oil. It’s a complex, carbon-rich solid that needs significantly more heat and pressure to break apart into liquid hydrocarbons.
Heat and Pressure Cook Kerogen Into Oil
The critical transformation happens during a stage called catagenesis, when the source rock is buried deep enough for temperatures to rise substantially. At depths typically between 2 and 4 kilometers, temperatures reach roughly 60 to 120°C (140 to 250°F). This is often called the “oil window,” the temperature range where thermal energy begins cracking the large kerogen molecules into smaller hydrocarbon chains that make up crude oil.
During catagenesis, the kerogen loses sulfur, oxygen, and other non-carbon elements as chemical bonds break apart. The long, chain-like portions of kerogen molecules snap into shorter molecules, producing a mix of liquid hydrocarbons. If burial continues and temperatures climb higher, above roughly 150°C, those liquid hydrocarbons themselves begin cracking into even smaller molecules, producing natural gas instead of oil. This is why the depth and temperature history of a source rock determines whether it yields oil, gas, or both.
This entire cooking process is extraordinarily slow. The organic matter that becomes today’s crude oil was deposited tens to hundreds of millions of years ago. The transformation from living organisms to extractable petroleum takes millions of years of sustained heat and burial.
How Oil Moves Through Rock
Oil doesn’t stay in the source rock where it forms. As hydrocarbons are generated, they occupy space within the rock and build up pressure. Because oil is less dense than the surrounding water-saturated rock, buoyancy pushes it upward and outward. This movement happens in two phases.
Primary migration is the initial expulsion of oil out of the fine-grained source rock. This is the harder step, since source rocks like shale have extremely tiny pore spaces. Pressure from the surrounding rock, combined with the expansion of hydrocarbons as they’re generated, squeezes oil out into adjacent, more permeable rocks.
Secondary migration is the longer journey through these more porous rocks, called carrier beds. Buoyancy is the main driver, pushing hydrocarbons upward through water-filled pore spaces. In some settings, groundwater flow driven by tectonic forces can also push oil laterally. These migration paths can be short, just a few meters, or stretch hundreds of kilometers from the source rock to the final resting place.
Reservoir Rocks That Store Oil
Oil accumulates in reservoir rocks that have two key properties: porosity (enough pore space to hold fluid) and permeability (connections between those pores that allow fluid to flow). Sandstones and certain limestones are the most common reservoir rocks. Typical porosity in a productive reservoir ranges from 5% to 30%, with 15% being a common value. That means roughly 15% of the rock’s volume consists of tiny spaces filled with oil, gas, or water.
Some reservoirs rely on natural fractures rather than pore spaces. Fractured reservoirs typically have much lower porosity, between 1% and 3%, but the fractures themselves are highly conductive, allowing oil to flow freely toward a well. These fractured reservoirs are significant producers worldwide, though they behave differently during extraction than conventional porous reservoirs.
Traps That Keep Oil Underground
Without a trap, migrating oil would simply seep all the way to the surface and dissipate. A petroleum trap is a geologic arrangement that stops upward migration and holds hydrocarbons in place. Every trap has two components: a geometry that funnels oil into a confined space, and a seal rock on top that blocks further movement.
Structural traps form when rock layers are bent or broken by tectonic forces. The most classic example is an anticline, an arch-shaped fold in the rock. Oil migrating upward along the tilted layers gets stuck at the crest of the fold with nowhere else to go. Domes are a circular version of the same idea. Faults can also create traps when a fracture in the rock shifts a permeable layer against an impermeable one, blocking the migration path. Normal faults, reverse faults, thrust faults, and strike-slip faults can all create trapping geometries depending on how the rock layers are offset.
Stratigraphic traps form from changes in the rock itself rather than from folding or faulting. A sandstone layer that pinches out and disappears laterally, for example, can trap oil where the porous sand grades into impermeable mud. Ancient reefs, river channels, and buried shorelines all create stratigraphic traps.
The seal, or cap rock, is what makes any trap work. Shale is the most common seal rock, but layers of salt, anhydrite, chert, and tightly cemented limestone also serve this purpose. These rocks have permeability so low that hydrocarbons cannot pass through them on geologic timescales. For a trap to hold a commercially meaningful amount of oil, it needs a porous reservoir below, an impervious seal above, no leaking faults cutting through, and enough migrated hydrocarbons to fill the structure.
The Full Picture
Oil formation is not a single event but a sequence of processes that must all occur in the right order. Abundant marine life has to die and accumulate in oxygen-poor waters. That organic material must be buried and preserved rather than decomposed. Millions of years of burial and heating must convert kerogen into liquid hydrocarbons. Those hydrocarbons must migrate out of the source rock and through carrier beds. And finally, a suitable trap with a good seal must be waiting to catch and hold the oil underground. Remove any one of these steps and you get no recoverable petroleum, which is why oil deposits are concentrated in specific sedimentary basins rather than distributed evenly across the planet.

