Abstract In forested headwater streams, inconspicuous food resources such as epilithic microalgae can play a major role owing to their content of long chain polyunsaturated fatty acids (PUFAs) that are essential for macroinvertebrate development. Yet, the use of these resources and their consequences for consumers and life‐history traits remain scarcely studied, especially for non‐herbivorous taxa. Using instream mesocosms, we aimed to understand how two macroinvertebrate species, a shredder detritivore (Gammarus pulex) and a scraper (Rhithrogena semicolorata), use available organic resources under light versus shaded conditions (high and low amounts of phototrophic biofilm, respectively). We specifically focused on the origin of carbon (C) and essential lipids (PUFAs, sterols) assimilated by the two species and the effects of these compounds on their survival and growth. When autotrophic biofilms were available (mesocosms exposed to light), both species experienced significantly higher growth than in mesocosms placed in the dark. In Rhithrogena nymphs, the survival and imago emergence rates were positively affected by access to autotrophic biofilms. Using stable isotope analysis (δ13C and δ15N), we demonstrated that under dark conditions both macroinvertebrates assimilated C of detrital origin. Under light conditions, most of the C assimilated by R. semicolorata was derived from autotrophic biofilms and around 11% from fine detrital particles (FPOM). Gammarus pulex derived part of its C from detrital sources (mainly FPOM) and from autotrophic biofilms. The results of isotopic analyses (δ13C) on fatty acids (FAs) and sterols showed that the scraper Rhithrogena was entirely dependent on autotrophic biofilms to meet its dietary FAs and sterol requirements. In contrast, detrital sources were quantitatively important for G. pulex both in terms of C and sterol supply, irrespective of the conditions tested. For these consumers, microalgae seemed to be a complementary food source, but yet essential to cover a large part of their requirements in long‐chain PUFAs. This study clearly confirmed the ecological importance of autotrophic biofilms for two functional feeding groups of macroinvertebrates in headwater streams providing new insights on the trophic origin of sterols and long‐chain PUFAs in their diet.