Many biochemical processes in living organisms take place inside compartments that can interact with each other and remodel over time. In a recent work, we have shown how the stochastic dynamics of a compartmentalized biochemical system can be effectively studied using moment equations. With this technique, the time evolution of a compartment population is summarized using a finite number of ordinary differential equations, which can be analyzed very efficiently. However, the derivation of moment equations by hand can become time-consuming for systems comprising multiple reactants and interactions. Here we present Compartor, a toolbox that automatically generates the moment equations associated with a user-defined compartmentalized system. Through the moment equation method, Compartor renders the analysis of stochastic population models accessible to a broader scientific community.