In chemistry, a hydrocarbon is an organic compound consisting only of carbon and hydrogen. They all consist of carbon backbone and atoms of hydrogen attached to that backbone, also see aliphatic hydrocarbons.