Coal is a fossil fuel formed over millions of years from the remains of plants that died in swamps and were buried under layers of sediment.