Fossil fuels such as coal, oil and natural gas take millions of years to form. Fossil fuels were once living organisms; after the organisms died, they were buried under layers and layers of sedimentary rock. The type of fossil fuels that form under different layers of rock depend on the original decomposed material, heat and varying pressure. However, three types of rocks are commonly associated in the formation of fossil fuels: sedimentary rock, porous and nonporous rocks.
Sedimentary rock plays a large role in the primary stages of fossil fuel formation. Fossil fuels are formed from the decay of plants and animals that lived millions of years ago. Their remains were buried under layers and layers of silt and ocean sediment that would eventually harden and turn into sedimentary rock. This layering of rocks creates pressure and is one of the first steps in the formation of fossil fuels such as coal, oil and natural gas.
Porous rocks play a part in the end stages of fossil fuel formation, particularly for the formation of oil and natural gas. Porous rocks, like the name suggests, are rocks that have lots of pores on their surface just like a sponge. Because of the great pressure caused by overlaying layers of rock, the oil and gas are eventually forced upward through the pores in the rock.
Nonporous rocks do not have any holes in their surface and oil and gas cannot pass through them. Nonporous rocks are crucial to the final stages where oil and natural gas collect because they provide a nonpenetrable barrier for the fossil fuels. Since the fuel has nowhere else to go, it collects beneath the nonporous rock. This is why nonporous rocks are sometimes referred to as "cap-rocks."