Oil is formed when organic materials are buried under sedimentary rock; anoxic conditions and intense pressure cause a gradual transformation in petroleum. Most of the components of oil are small algae and zooplankton, although some larger animals like dinosaurs are also in the mix. This process takes hundreds of thousands of years.
Oil formation requires a combination of several factors. Scientists refer to petroleum as a fossil fuel because it is derived from prehistoric organisms. Plants and animals settle below land and sea along with sand and silt. These remains are gradually covered by sedimentary rock buildup, which creates heat and pressure. These conditions turn anoxic, meaning that there is a lack of dissolved oxygen in the system.
Heat and pressure first turn the organic matter into kerogen, a waxy material. As heat and pressure increase, the kerogen undergoes the process of catagenesis, which transforms the material into liquid and gaseous hydrocarbons.
In order for oil to form, the mixture must achieve a temperature that geologists refer to as the "oil window." Otherwise, it remains in its kerogen state.
Over time, the oil travels upward through pores in the rock. Some seeps out onto the Earth's surface, but most remains stuck in barriers. Underground traps of oil are called reservoirs. People extract oil from reservoirs through drilling.