Production of $B_c^+$ mesons in proton-proton collisions at a center-of-mass energy of 8 TeV is studied with data corresponding to an integrated luminosity of $2.0~{rm fb}^{-1}$ recorded by the LHCb experiment. The ratio of production cross-sections times branching fractions between the $B_c^+to J/psi pi^+$ and $B^+to J/psi K^+$ decays is measured as a function of transverse momentum and rapidity in the regions $0 < p_{rm T} < 20~{rm GeV}/c$ and $2.0 < y < 4.5$. The ratio in this kinematic range is measured to be $(0.683pm0.018pm0.009)%$, where the first uncertainty is statistical and the second systematic.