The temporal variability of ecological communities may depend on species richness and composition due to a variety of statistical and ecological mechanisms. However, ecologists currently lack a general, unified theoretical framework within which to compare the effects of these mechanisms. Developing such a framework is difficult because community variability depends not just on how species vary, but also how they covary, making it unclear how to isolate the contributions of individual species to community variability. Here I develop such a theoretical framework using the multi-level Price equation, originally developed in evolutionary biology to partition the effects of group selection and individual selection. I show how the variability of a community can be related to the properties of the individual species comprising it, just as the properties of an evolving group can be related to the properties of the individual organisms comprising it. I show that effects of species loss on community variability can be partitioned into effects of species richness (random loss of species), effects of species composition (non-random loss of species with respect to their variances and covariances), and effects of context dependence (post-loss changes in species’ variances and covariances). I illustrate the application of this framework using data from the Biodiversity II experiment, and show that it leads to new conceptual and empirical insights. For instance, effects of species richness on community variability necessarily occur, but often are swamped by other effects, particularly context dependence.