Coal is mostly carbon with variable amounts of other elements, mostly hydrogen, sulfur, oxygen and nitrogen. Coal is a type of fossil fuel, formed when dead plant matter decays into peat and is converted into coal by the heat and pressure of deep burial over millions of years.