Hierarchical mergers are one of the distinctive signatures of binary black hole (BBH) formation through dynamical evolution. Here, we present a fast semi-analytic approach to simulate hierarchical mergers in nuclear star clusters (NSCs), globular clusters (GCs) and young star clusters (YSCs). Hierarchical mergers are more common in NSCs than they are in both GCs and YSCs because of the different escape velocity. The mass distribution of hierarchical BBHs strongly depends on the properties of first-generation BBHs, such as their progenitor’s metallicity. In our fiducial model, we form black holes (BHs) with masses up to ∼103 M⊙ in NSCs and up to ∼102 M⊙ in both GCs and YSCs. When escape velocities in excess of 100 km s−1 are considered, BHs with mass >103 M⊙ are allowed to form in NSCs. Hierarchical mergers lead to the formation of BHs in the pair instability mass gap and intermediate-mass BHs, but only in metal-poor environments. The local BBH merger rate in our models ranges from ∼10 to ∼60 Gpc−3 yr−1; hierarchical BBHs in NSCs account for ∼10−2–0.2 Gpc−3 yr−1, with a strong upper limit of ∼10 Gpc−3 yr−1. When comparing our models with the second gravitational-wave transient catalog, we find that multiple formation channels are favored to reproduce the observed BBH population.