Herbivory is typically intense in marine littoral environments; thus, macrophytes are expected to evolve defenses against grazing. Although putative defenses of macrophytes are widely studied, there is lack of studies demonstrating the main premises of defense adaptations: the consequences of herbivory to macrophytes, genetic variation of defense traits and the costs and benefits of defenses in natural environment. We conducted a factorial experiment, where we manipulated amount of herbivory, growing depth and nutrient availability, and measured resistance to herbivory as well as genetic variation and costs of phlorotannins, putative defensive secondary metabolites, in the brown alga Fucus vesiculosus. Herbivory on algae varied with depth: grazing did not cause losses close to the surface, but, most of the algal production was consumed at the deeper end of the algal belt. The higher the genotypic phlorotannin content the less damage the genotype received implying that phlorotannins acted as a resistance trait. Production of phlorotannins was associated with costs for growth. Consistent with the prediction that the cost of defense will be greatest when resources are limiting, the cost appeared only in the deep end of the algal belt where growth was slowed down. Phlorotannins displayed phenotypic plasticity; the three factors influenced phlorotannins interactively, with the main tendencies of nutrient enrichment decreasing and herbivory and increasing depth increasing phlorotannins. Despite this plasticity, variation of phlorotannins was mainly due to the genotype of algae. These results emphasize the role of herbivory as a selective agent for algal defenses and the importance of genetic variation in the constitutive level of phlorotannins in interactions with natural enemies. The cost of phlorotannins may constrain the evolution of resistance in environments where growth is limited by light availability.