The relative contribution of aquatic vs. terrestrial organic matter to the diet of consumers in fluvial environments and its effects on bioaccumulation of contaminants such as mercury (Hg) remain poorly understood. We used stable isotopes of carbon and nitrogen in a gradient approach (consumer isotope ratio vs. periphyton isotope ratio) across temperate streams that range in their pH to assess consumer reliance on aquatic (periphyton) vs. terrestrial (riparian vegetation) organic matter, and whether Hg concentrations in fish and their prey were related to these energy sources. Taxa varied in their use of the two sources, with grazing mayflies (Heptageniidae), predatory stoneflies (Perlidae), one species of water strider (Metrobates hesperius), and the fish blacknose dace (Rhinichthys atratulus) showing strong connections to aquatic sources, while Aquarius remigis water striders and brook trout (Salvelinus fontinalis) showed a weak link to in-stream production. The aquatic food source for consumers, periphyton, had higher Hg concentrations in low-pH waters, and pH was a much better predictor of Hg in predatory invertebrates that relied mainly on this food source vs. those that used terrestrial C. These findings suggest that stream biota relying mainly on dietary inputs from the riparian zone will be partially insulated from the effects of water chemistry on Hg availability. This has implications for the development of a whole-system understanding of nutrient and material cycling in streams, the choice of taxa in contaminant monitoring studies, and in understanding the fate of Hg in stream food webs.