A hydrocarbon is a compound made up of only hydrogen and carbon atoms. They are the main component of fossil fuels like coal, oil, and natural gas, and are widely used as sources of energy and raw materials in various industries. Examples include methane, propane, and octane.