1. Photoprotective pigments in benthic macroinvertebrates may reduce the damage caused by the blistering UV-B radiation in Andean high-altitude streams above 3500 m. The aim of this study was therefore to determine whether melanisation in macroinvertebrates inhabiting high-altitude Andean streams is an adaptive response to high UV-B radiation. To explore whether altitude-related differences in melanin concentration between taxa were due to a variable community composition or due to population differentiation, mayfly species were identified genetically. 2. We measured UV-B radiation from 650 to 4000 m and compared body melanin concentrations from several benthic macroinvertebrate orders sampled at these altitudes. Five genera belonging to the mayfly family Baetidae were genetically identified to the species level. DNA sequencing was performed in individual larval legs to group genetically similar individuals before pigment analysis in the corresponding bodies. 3. The UV-B radiation at 4000 m was twice that at 3200 m, four times that at 1900 m and five times that at 650 m. The melanin concentration in families belonging to Ephemeroptera, Trichoptera, Diptera and Turbellaria was twice as high at 4000 m as at 3200 m, but did not differ among taxa or between seasons. Five genera of the family Baetidae were identified: Americabaetis, Dactylobaetis, Tupiara, Baetodes and Thraulodes. Genetic differences were evident between Americabaetis sp. at 4000 m from the Cordillera Blanca and at 3200 m from the R ımac River valley, and between Tupiara taxa at 650 and 1900 m in the R ımac River. In Americabaetis, melanin increased fivefold from 1900 to 4000 m, while in Dactylobaetis and Tupiara, it was twice as high at 1900 m as at 650 m. In Baetodes, melanin at 4000 m was twice that at 650 and 1900 m, while in Thraulodes, it was almost three times higher at 4000 m than at 3200 m. 4. In Tupiara, the differences in melanin levels were probably associated with species with different vertical distribution, while in Dactylobaetis, these differences were interpreted as phenotypic plasticity. Our results thus indicate that mayfly species within a single family have both constitutive and adjustable melanin concentrations, enabling them to cope with the strong selective UV-B environment. Adjustable melanin levels have commonly been observed under moderate UV-B regimes, while the constitutive, high melanin concentration is probably an attribute of high-altitude invertebrate fauna in the tropics.