text: Crude oil is formed from accumulations of small organisms, mostly phytoplankton and zooplanton that are buried in sediments in both marine and lacustrine (fresh water) environments. Other organic material is mixed in such as spores, pollen, woody material, and other material such as fecal pellets from marine organisms. These materials often settle through the water into an organic-rich mud that is very low in oxygen (anaerobic) so there are few organisms to feed on the material  and it accumulates over long periods of time. Rivers contribute to this process by both delivering large quantities of organic matter, and also large amounts of sediment to bury this organic matter. \n\nOver time these clay-rich sediments are buried under thousands of feet of sediments, dewatered by pressure from the overlying sediment and become shale. As the shale is buried its temperature increases due to geothermal warming. When it reaches temperatures and pressures of 140 degrees F. (60 C) it begins to convert to oil. As temperature increases from continuing burial processes it reachs a temperature where it begins to form natural gas. Both the oil and the gas are gradually expelled from the shale. Typically shales are found in depostional settings where they may be interbedded with sandstones. Sandstones will have higher porosity (more and bigger holes) than shale and the oil and gas will displace salt water that is remaining in the sandstones. Eventually the oil and gas migrates upward through the water and if the overlying structure has formed some sort of a trapping configuration, (like a sandstone overlain by an impervious shale, or a fault that has created a seal against the sandstone, then this becomes an oil reservoir. \n\nA very similar process occurs in carbonate rocks, like limestone and dolomite, except the organic material originates within the carbonate rock in many instances. If the carbonate reef (for example) has been buried by an impervious layer of shale or carbonate mud of a sabkha, it  will become an oil reservoir.  In other instances, the source of the oil will be a shale that is below the carbonate rocks, and the oil will migrate upward into this reservoir.