Fossil fuels are a nonrenewable resource formed from the remains of ancient plants and animals. There are three main types of fossil fuels: coal, natural gas, and oil. Coal forms from the decay and compression of plant matter over millions of years. Oil forms similarly from the remains of organisms buried under layers of sediment. Natural gas is created through the same process. Fossil fuels are burned as an energy source, with coal powering electricity generation, and oil refined into gasoline, jet fuel, and diesel. The Exxon Valdez and Deepwater Horizon oil spills both caused environmental damage through oil leaks into waterways.