We present a systematic procedure for analyzing cumulants to arbitrary order in the context of heavy-ion collisions. It generalizes and improves existing procedures in many respects. In particular, particles which are correlated are allowed to belong to different phase-space windows, which may overlap. It also allows for the analysis of cumulants at any order, using a simple algorithm rather than complicated expressions to be derived and coded by hand. In the case of azimuthal correlations, it automatically corrects to leading order for detector non-uniformity, and it is useful for numerous other applications as well. We discuss several of these applications: anisotropic flow, event-plane correlations, symmetric cumulants, net baryon and net charge fluctuations.