Tens of millions of years. Coal is a fossil fuel created from the remains of plants that lived and died about 100 to 400 million years ago when parts of the earth were covered with huge swampy forests. Coal is classified as a nonrenewable energy source because it takes millions of years to form.
When coal is burned, chemical energy changes to thermal energy. The energy of sunlight was stored in the organic molecules of dead plants, which were compressed and altered to form long-chain hydrocarbons. Burning the coal oxidizes these molecules, releasing heat.
Coal deposits form over a long period of time through biological and geological process. Dead plant matter is converted into peat, which is converted into lignite. Lignite is converted into sub-bituminous coal, after that bituminous coal, and lastly anthracite.