Oxygenic photosynthesis is widely accepted as the most important bioenergetic process happening in Earth's surface environment. It is thought to have evolved within the cyanobacterial lineage, but it has been difficult to determine when it began. Evidence based on the occurrence and appearance of stromatolites and microfossils indicates that phototrophy occurred as long ago as 3,465 Myr although no definite physiological inferences can be made from these objects. Carbon isotopes and other geological phenomena provide clues but are also equivocal. Biomarkers are potentially useful because the three domains of extant life - Bacteria, Archaea and Eukarya - have signature membrane lipids with recalcitrant carbon skeletons. These lipids turn into hydrocarbons in sediments and can be found wherever the record is sufficiently well preserved. Here we show that 2-methylbacteriohopanepolyols occur in a high proportion of cultured cyanobacteria and cyanobacterial mats. Their 2-methylhopane hydrocarbon derivatives are abundant in organic-rich sediments as old as 2,500 Myr. These biomarkers may help constrain the age of the oldest cyanobacteria and the advent of oxygenic photosynthesis. They could also be used to quantify the ecological importance of cyanobacteria through geological time.