Oil and natural gas are formed by organic matter deep in the earth by dead plants and animals. This formation typically takes millions of years under very specific pressure and temperature conditions.
When plants and animals die, they are exposed to ambient air or oxygen-rich water which causes it to oxidize. All elements contained in the matter combine with oxygen in the air and breaks down into the water, carbon dioxide, nitrates, sulfates and phosphates that return to nourish new plants.
Some of this organic matter escape this fate and are transported by the water where they end up at the bottom of the sea or in large continental lakes. At a depth of 2,000 meters and temperature of 100oC, kerogen begins to release hydrocarbons. Between 2,000 to 3,800 meters, it turns to oil. This depth interval is also known as the oil window. Production of hydrocarbons peaks at 3,800 to 5,000 meters. Liquids become lighter and gradually turn to methane gas. This depth interval is referred to as the gas window.
A petroleum reservoir is a subsurface pool of hydrocarbons contained in porous or fractured rock formations. Reservoir rocks are typically sandstone reservoirs and carbonate reservoirs. Sandstone reservoirs are of a higher quality because it contains a primary mineral called quartz which is strong and stable. The carbonate reservoirs are formed from coral, shells and other biogenic materials making them less solid than sandstone. There are two broad categories of petroleum reservoirs: the conventional and the unconventional reservoirs. In conventional reservoirs, naturally occurring hydrocarbons such as crude oil and natural gas are trapped by overlying rock formations with low permeability. However, in unconventional reservoirs, the rocks have high porosity and also low permeability that keep the hydrocarbons trapped in place. This does not require a cap rock. Petroleum reservoirs are found using hydrocarbon exploration processes.
The proportion of liquids (oil) and gas generated in this process depends on the type of source rock. More oil than gas will be produced if the organic debris is composed mostly of animal origin. However, if the organic debris consists of mostly plant debris, the source rock will produce mostly gas.
It takes about 60 million years for dead animals to become liquid hydrocarbons with an average sedementation of 50 meters every million years.