Families of closely related chemical compounds, which are relatively resistant to degradation, are often used as biomarkers to help trace the evolutionary history of early groups of organisms and the environments in which they lived. Biomarkers derived from hopanoid variations are particularly useful in determining bacterial community compositions. 2-Methylhopananoids have been thought to be diagnostic for cyanobacteria, and 2-methylhopanes in the geological record are taken as evidence for the presence of cyanobacteria-containing communities at the time of sediment deposition. Recently, however, doubt has been cast on the validity of 2-methylhopanes as cyanobacterial biomarkers, since non-cyanobacterial species have been shown to produce significant amounts of 2-methylhopanoids. This study examines the diversity of hpnP, the hopanoid biosynthesis gene coding for the enzyme that methylates hopanoids at the C2 position. Genomic DNA isolated from stromatolite-associated pustular and smooth microbial mat samples from Shark Bay, Western Australia, was analysed for bacterial diversity, and used to construct an hpnP clone library. A total of 117 partial hpnP clones were sequenced, representing 12 operational taxonomic units (OTUs). Phylogenetic analysis showed that 11 of these OTUs, representing 115 sequences, cluster within the cyanobacterial clade. We conclude that the dominant types of microorganisms with the detected capability of producing 2-methylhopanoids within pustular and smooth microbial mats in Shark Bay are cyanobacteria.