Fossil fuels
Coal
Coal is a combustible sedimentary rock formed from the remains of plant life which have been subject to geological heat and pressure.
This action changed plant material in stages to increase the percentage of the carbon content.
Coal generally contains between 80% and 90% carbon by mass.
Crude oil
It is a complex mixture of straight-chain and branched-chain saturated alkanes, cycloalkanes and aromatic compounds, and, in smaller quantities, compounds of nitrogen, oxygen and sulfur.
Crude oil was formed over millions of years from the remains of marine animals and plants, which were trapped under layers of rock.
Under these conditions of high temperature and high pressure, organic matter decays in the presence of bacteria and the absence of oxygen.
Natural gas
Methane is the primary constituent of natural gas, which also contains N and S compounds
It was formed millions of years ago by the action of heat, pressure, and bacteria in organic matter.

Biofuels

Fuel cells
Primary (Voltaic) cell
Secondary cell
Fuel cell
Hydrogen fuel cell
Hydrogen + Oxygen gases:

Proton Exchange Membrane (PEM) selectively allows hydrogen ions (protons) to diffuse between anode and cathode but prevents passage of e-, other ions and molcules.
Hydrogen gas is oxidized at the anode: H2 (g) → 2H+ + 2e–.
e– cannot move through the PEM, and thus leaves through the circuit generating electrical output.
Oxygen combined with the hydrogen ions: O2 (s) + 4e– → 4H+ + 2H2O
Production of H2
Electrolysis of water
Steam reforming of hydrocarbons:
CnH2n+2 + nH2O nCO + (2n+1)H2
Carbon monoxide forms CO2
Methanol fuel cell
Liquid at room temperature
Anode: CH3OH + H2O → CO2 + 6H+ + 6e–
Cathode: O2 + 6H+ + 6e– → 3H2O
Overall: CH3OH + O2 → CO2 + 2H2O