Hydrocarbon, any of a class of organic chemical compounds composed only of the elements carbon (C) and hydrogen (H). The carbon atoms join together to form the framework of the compound, and the hydrogen atoms attach to them in many different configurations. Hydrocarbons are the principal constituents of petroleum and natural gas. Most hydrocarbons are generated from the thermal ‘cracking’ and fractional distillation of crude oil. The greatest amounts of hydrocarbons are used as fuel for combustion, particularly in heating and motor fuel applications.