Abstract Next generation ground-based gravitational-wave detectors will observe binary black hole (BBH) mergers up to redshift , probing the evolution of compact binary (CB) mergers across cosmic time. Here, we present a new data-driven model to estimate the cosmic merger rate density (MRD) evolution of CBs, by coupling catalogs of CB mergers with observational constraints on the cosmic star formation rate (SFR) density and on the metallicity evolution of the universe. We adopt catalogs of CB mergers derived from recent N-body and population-synthesis simulations, to describe the MRD of CBs formed in young star clusters (hereafter, dynamical CBs) and in the field (hereafter, isolated CBs). The local MRD of dynamical BBHs is Gpc−3 yr−1, consistent with the 90% credible interval from the first and second observing runs (O1 and O2) of the LIGO–Virgo collaboration, and with the local MRD of isolated BBHs ( Gpc−3 yr−1). The local MRD of dynamical and isolated black hole–neutron star binaries is and Gpc−3 yr−1, respectively. Both values are consistent with the upper limit inferred from O1 and O2. Finally, the local MRD of dynamical binary neutron stars (BNSs, Gpc−3 yr−1) is a factor of two lower than the local MRD of isolated BNSs ( Gpc−3 yr−1). The MRD for all CB classes grows with redshift, reaching its maximum at , and then decreases. This trend springs from the interplay between cosmic SFR, metallicity evolution, and delay time of binary compact objects.