Crude oil and natural gas are called fossil fuels because they were created from biotic materials: tiny terrestrial marine plants and animals. Millions of years ago, these microscopic plants and animals absorbed energy from the sun, which was stored as carbon molecules in their bodies. They died and were buried by layers of sediment, water and sand. Microscopic organisms fed on the decomposing organic material in a process called biogenesis. Specific high temperatures and pressure conditions are required to induce formation of hydrocarbons, such as crude oil, wet gas, dry gas, etc.
Geologic time and the rock cycle play an important role in the formation of these hydrocarbons.
There are two types of rocks that are important in crude oil and natural gas formation: reservoir rocks and source rocks. Reservoir rocks are where the hydrocarbons migrate (from historic production) and become trapped. Most source rocks are gray or black shale. Biotic materials that form hydrocarbons are incorporated into source rocks when they are formed.