Microbial nitrogen fixation (diazotrophy) is a functional trait widely associated with tropical reef-building (scleractinian) corals. While the integral role of nitrogen fixation in coral nutrient dynamics is recognized, its ecological significance across different coral functional groups remains yet to be evaluated. Here we set out to compare molecular and physiological patterns of diazotrophy (i.e., nifH gene abundance and expression as well as nitrogen fixation rates) in two coral families with contrasting trophic strategies: highly heterotrophic, free-living members of the family Fungiidae (Pleuractis granulosa, Ctenactis echinata), and mostly autotrophic coral holobionts with low heterotrophic capacity (Pocilloporidae: Pocillopora verrucosa, Stylophora pistillata). The Fungiidae exhibited low diazotroph abundance (based on nifH gene copy numbers) and activity (based on nifH gene expression and the absence of detectable nitrogen fixation rates). In contrast, the mostly autotrophic Pocilloporidae exhibited nifH gene copy numbers and gene expression two orders of magnitude higher than in the Fungiidae, which coincided with detectable nitrogen fixation activity. Based on these data, we suggest that nitrogen fixation compensates for the low heterotrophic nitrogen uptake in autotrophic corals. Consequently, the ecological importance of diazotrophy in coral holobionts may be determined by the trophic functional group of the host.