The relative rates of B-meson decays into J/ψ and ψ(2S) mesons are measured for the three decay modes in pp collisions recorded with the LHCb detector. The ratios of branching fractions ([Formula: see text]) are measured to be [Formula: see text] where the third uncertainty is from the ratio of the ψ(2S) and J/ψ branching fractions to μ+μ-.