The biodiversity of food webs is composed of horizontal (i.e. within trophic levels) and vertical diversity (i.e. the number of trophic levels). Understanding their joint effect on stability is a key challenge. Theory mostly considers their individual effects and focuses on small perturbations near equilibrium in hypothetical food webs. Here, we study the joint effects of horizontal and vertical diversity on the stability of hypothetical (modelled) and empirical food webs. In modelled food webs, horizontal and vertical diversity increased and decreased stability, respectively, with a stronger positive effect of producer diversity on stability at higher consumer diversity. Experiments with an empirical plankton food-web, where we manipulated horizontal and vertical diversity and measured stability from species interactions and from resilience against large perturbations, confirmed these predictions. Taken together, our findings highlight the need to conserve horizontal biodiversity at different trophic levels to ensure stability.