We explore hierarchical black hole (BH) mergers in nuclear star clusters (NSCs), globular clusters (GCs) and young star clusters (YSCs), accounting for both original and dynamically assembled binary BHs (BBHs). We find that the median mass of both first- and nth-generation dynamical mergers is larger in GCs and YSCs with respect to NSCs, because the lighter BHs are ejected by supernova kicks from the lower-mass clusters. Also, first- and nth-generation BH masses are strongly affected by the metallicity of the progenitor stars: the median mass of the primary BH of a nth-generation merger is ∼24−38 M⊙ (∼9−15 M⊙) in metal-poor (metal-rich) NSCs. The maximum BH mass mainly depends on the escape velocity: BHs with mass up to several thousand M⊙ form in NSCs, while YSCs and GCs host BHs with mass up to several hundred M⊙. Furthermore, we calculate the fraction of mergers with at least one component in the pair-instability mass gap (fPI) and in the intermediate-mass BH regime (fIMBH). In the fiducial model for dynamical BBHs with metallicity Z=0.002, we find fPI≈0.05, 0.02 and 0.007 (fIMBH≈0.01, 0.002 and 0.001) in NSCs, GCs and YSCs, respectively. Both fPI and fIMBH drop by at least one order of magnitude at solar metallicity. Finally, we investigate the formation of GW190521 by assuming that it is either a nearly equal-mass BBH or an intermediate-mass ratio inspiral.