Oil was formed millions of years ago before the existence of dinosaurs. Tiny, one-celled organisms living in the seas died and collected on the ocean floor. These marine organisms mixed with sand and mud and were covered by layers of sediment. Over millions of years the seas receded leaving these remains under hundreds or thousands of feet of earth. These organisms slowly decomposed and began to form fossil fuels. The type of fuel fuel depends on many factors. The combination of animal and plant debris, and the length of time the material was buried. As well as temperature and pressure during decomposition. Sometimes there wasn't enough oxygen to completely decompose the material. Bacteria would break down this trapped residue into substances rich in carbon and hydrogen. Increasing heat and pressure caused oil to form and it slowly seeped between rock layers until they ran into "cap rocks." Cap rocks are rocks that are dense enough to hold back the oil.