Fossil fuels such as coal, oil, and natural gas were formed from the remains of ancient organisms that lived hundreds of millions of years ago during the Carboniferous Period. Coal is made primarily of carbon while oil and natural gas are made mostly of carbon and hydrogen. Coal comes in different forms like anthracite, bituminous, and lignite that provide varying amounts of energy. Fossil fuels are used to power factories and buildings, for transportation and manufacturing products, and for heating and cooking. Refineries process crude oil into usable forms like gasoline, diesel, and heating oil.