Five representative coal samples used for coking were carbonized in a thermogravimetric analyzer to simulate an industrial coking process. The gaseous organic compounds generated were analyzed with a coupled mass spectrometer. During coal carbonization, thermal detachment of aliphatic side groups causes disintegration of the coal structure. Methyl groups detach at higher temperatures than methylene and methine groups, and the temperatures corresponding to peak generation of these groups increase with the metamorphic grade of the coal. Methane is generated by three mechanisms: below 370 °C, methane adsorbed in coal is thermally released; at about 510 °C, methyl groups are thermally detached from the coal to form CH3+ ions, which further combine with hydrogen to form methane; finally, at about 720 °C, methane is produced as a result of the condensation of aromatic rings to form larger fused rings. Benzene is also generated by three mechanisms: at 400–500 °C, aromatic structures in coal lose side groups (e.g. methylene or methine) to form benzene ions, which subsequently react with hydrogen to form benzene; at 500–700 °C, benzyl structures in coal lose methyl groups to form benzene ions, which then combine with hydrogen to form benzene; finally, at about 800 °C, condensation of fragments in coal also forms benzene.