Cellular energy generation uses membrane-localized electron transfer chains for ATP synthesis. Formed ATP in turn is consumed for the biosynthesis of cellular building blocks. In contrast, heme cofactor biosynthesis was found driving ATP generation via electron transport after initial ATP consumption. The FMN enzyme protoporphyrinogen IX oxidase (HemG) of Escherichia coli abstracts six electrons from its substrate and transfers them via ubiquinone, cytochrome bo(3) (Cyo) and cytochrome bd (Cyd) oxidase to oxygen. Under anaerobic conditions electrons are transferred via menaquinone, fumarate (Frd) and nitrate reductase (Nar). Cyo, Cyd and Nar contribute to the proton motive force that drives ATP formation. Four electron transport chains from HemG via diverse quinones to Cyo, Cyd, Nar, and Frd were reconstituted in vitro from purified components. Characterization of E. coli mutants deficient in nar, frd, cyo, cyd provided in vivo evidence for a detailed model of heme biosynthesis coupled energy generation.