All-perovskite tandem solar cells hold the promise of surpassing the efficiency limits of single-junction solar cells1–3; however, until now, the best-performing all-perovskite tandems have exhibited lower certified efficiency than have single-junction perovskite solar cells4,5. A thick mixed Pb-Sn narrow-bandgap subcell is needed to achieve high photocurrent density in tandems6; yet this is challenging owing to the short carrier diffusion length within Pb-Sn perovskites. Here we develop ammonium-cation-passivated Pb-Sn perovskites with long diffusion lengths, enabling subcells having an absorber thickness of ~1.2 μm. Molecular dynamics simulations suggest that widely-used phenethylammonium (PEA) cations are only partially adsorbed on the surface defective sites at perovskite crystallization temperatures. The passivator adsorption is predicted to be enhanced using 4-trifluoromethyl-phenylammonium (CF3-PA), which exhibits a stronger perovskite surface-passivator interaction than does PEA. By adding a small amount of CF3-PA into precursor solution, we increase the carrier diffusion length within Pb-Sn perovskites by 2x, to over 5 μm, and increase the efficiency of Pb-Sn perovskite solar cells to over 22%. We report a certified efficiency of 26.4% in all-perovskite tandem solar cells, exceeding that of the best-performing single-junction perovskite solar cells. Encapsulated tandem devices retain >90% of initial performance following 600 hours of operation at the maximum power point under one-sun illumination in ambient conditions.