Hydrocarbons are organic compounds consisting solely of hydrogen and carbon atoms, classified into three main types: 1) alkanes, which have all single bonds (CnH2n+2), 2) alkenes, which contain at least one double bond (CnH2n), and 3) alkynes, which have triple bonds and fewer hydrogen atoms (CnH2n-2).