Coal, which is used by human beings to generate electricity, is a sedimentary rock made from ancient plant matter.

Because it is made from living things, coal consists mostly of carbon. It also contains nitrogen, oxygen, hydrogen and sulfur.

Hundreds of millions of years ago, during the Carboniferous ("coal-bearing") era, oceans were wide and shallow.

Giant ferns grew in bogs that were often many miles across.

Every year these ferns would drop their leaves.

Beds of dead leaves and trees formed in the bogs. These dark brown beds, known as peat, grew to be many feet thick.

Throughout the Earth's history, the oceans have repeatedly flowed over dry land and then receded.

Each time water has covered the land, it has left behind sediment.

Over time, peat became covered with sediment. The weight of the sediment crushed it, dried it out and made it become darker. Eventually, the peat was transformed into the brownish-black substance we know as coal.

When the oceans receded, peat would accumulate once more.

Eventually, layers of coal alternated with layers of sediments washed in from the ocean. These layers of coal are known as coal beds.

Some harder forms of coal, such as anthracite coal, are formed when coal is exposed to high temperatures and pressures. Therefore, these types of coal can be considered metamorphic rocks.