# What happens to the oxygen when carbohydrates turn into hydrocarbons?

According to the biogenic theory of hydrocarbon formation, hydrocarbons come from pressurized carbohydrates.

I am looking for an explanation of what happens to the oxygen in the process. How could the oxygen break away from the hydroxyl groups of molecules like glucose to form hydrocarbons?

The process likely involves pyrolysis, a generic term for the thermal degradation pathways of organic compounds.

In the case of carbohydrates, like glucose (shown below), the most common function groups are alcohols (R-OH). Alcohols undergo dehydration in the presence of strong acids, but the reaction can also be promoted by extreme heat in the absence of oxygen. The presence of oxygen leads to combustion (bad!).

In a dehydration elimination reaction, the OH on one carbon and the H on a neighboring carbon leave to form water. This usually follows an E1-like mechanism, involving a carbocation intermediate. In the geochemical version, the necessary acid could come from nearby slightly acidic mineral.

Protonation of the alcohol: $$\ce{(CH3)2CH-OH + H+ -> (CH3)2CH-OH2+}$$ Loss of leaving group: $$\ce{(CH3)2-CH-OH2+ -> (CH3)2CH+ + H2O}$$ Loss of proton (regeneration of acid): $$\ce{CH3-CH+-CH2-{\bf{H}} -> CH3-CH=CH2 + {\bf{H+}}}$$

Overall: $$\ce{(CH3)2CH-OH ->[\ce{H+}][\Delta] CH3-CH=CH2 + H2O }$$

In the case of carbohydrates, they tend to dehydrate to carbonyl compounds, which can then decompose further into hydrocarbons by reductive and radical pathways.

For example, fructose is converted into furan derivatives, like 5-hydroxymethylfurfural, by a series of dehydrations and rearrangements:

$$\ce{C6H12O6 ->[\ce{H+}][\Delta] C6H6O3 + 3H2O}$$

The image above was created by Wikipedia user V8rik and released under the GNU Free Documentation License and the Creative Commons Attribution-Share Alike 3.0 Unported License.

This will largely depend upon the reagents that perform the reduction.

When using $\ce{HI}$ (or a strong acid and heat or $\ce{H2}$ and $\ce{Pd/C}$) the reaction goes as follows.

$\ce{C6H12O6 ->[H^+] C6H14 + H2O}$ (organic products only)

As others answers have pointed out, the main pathways for reducing carbohidrates to hydrocarbons involves the dehydration elimination of the alcohol groups. This reaction is catalized by acidic conditions and can be carried out with linear alcohols (i.e. like ethanol, resulting in an olefin) in laboratory conditions, at temperatures higher than 160 °C and atmospheric pressure. The products are unsaturated compounds and water.

Even if the geochemical conditions don't allow a strongly acidic medium, the pressures and temperatures attained should be enough to pyrolitically dehydrate sugars and cellulosic material which makes up most of the cell walls of vegetal biomass. Nevertheless, pyrolitic conversion of mainly-cellulosic biomass in sedimentary basins ussually doesn't produce aliphatic hydrocarbons. Instead, the carbon skeletons are further dehydrogenated and compressed forming coal deposits containing minor aromatic derivatives like phenols and aniline.

The main source of hydrocarbon deposits is the pyrolitic decarboxylation of fatty acids, in turn produced by the hydrolisis of lipids. Those lipids mostly come from microphytes (microalgae) which comprise most of the phytoplancton in the seas, and which have been accumulated at the bottom of ancient oceans. For example, the rich sedimentary basin of modern Middle East was once the Tethys Ocean seabed.

So, in essence, both in the dehydration of carbohidrates and in the decarboxylation of fatty acids, the oxygen goes away in the form of water or carbon dioxide.