CnHm + (n + m/4)O2 → nCO2 + m/2 H2O
For example, when methane (CH4), the simplest hydrocarbon, undergoes combustion, it reacts with two molecules of oxygen to produce one molecule of carbon dioxide and two molecules of water:
CH4 + 2O2 → CO2 + 2H2O
The combustion of hydrocarbons is an exothermic process, meaning that it releases heat energy. This heat energy is what makes hydrocarbon fuels, such as gasoline and natural gas, useful as sources of energy.