Crude oil, or petroleum, is a substance composed of hydrocarbons - chains of hydrogen and carbon atoms - that provide energy and can be transformed into a variety of petrochemical products. Much of the world's petroleum began as organic material from ancient seas, wetlands, and forests, which was buried under sediments faster than it could decompose. At depths between 7,650 and 15,000 feet, heat and pressure slowly transformed it into petroleum.
Oil then accumulated in porous sandstone or limestone with an impermeable cap, such as shale or salt, which prevents it from escaping. The oil that does escape is often transformed into tar by bacteria and groundwater.