Bacterial aerobic ammonium oxidation and anaerobic ammonium oxidation (anammox) are important processes in the global nitrogen cycle. Key enzymes in both processes are the octahaem cytochrome c (OCC) proteins, hydroxylamine oxidoreductase (HAO) of aerobic ammonium-oxidizing bacteria (AOB), which catalyses the oxidation of hydroxylamine to nitrite, and hydrazine oxidoreductase (HZO) of anammox bacteria, which converts hydrazine to N2. While the genomes of AOB encode up to three nearly identical copies of hao operons, genome analysis of Candidatus‘Kuenenia stuttgartiensis’ showed eight highly divergent octahaem protein coding regions as possible candidates for the HZO. Based on their phylogenetic relationship and biochemical characteristics, the sequences of these eight gene products grouped in three clusters. Degenerate primers were designed on the basis of available gene sequences with the aim to detect hao and hzo genes in various ecosystems. The hao primer pairs amplified gene fragments from 738 to 1172 bp and the hzo primer pairs amplified gene fragments from 289 to 876 bp in length, when tested on genomic DNA isolated from a variety of AOB and anammox bacteria. A selection of these primer pairs was also used successfully to amplify and analyse the hao and hzo genes in community DNA isolated from different ecosystems harbouring both AOB and anammox bacteria. We propose that OCC protein-encoding genes are suitable targets for molecular ecological studies on both aerobic and anaerobic ammonium-oxidizing bacteria.