The total cross section and differential cross sections for the production of Bc± mesons, times their branching fraction to J/ψπ±, are measured relative to those for the production of B± mesons, times their branching fraction to J/ψK±. The data used for this study correspond to an integrated luminosity of 20.3 fb-1 of pp collisions recorded by the ATLAS detector at the Large Hadron Collider in 2012 at a center-of-mass energy of s=8 TeV. The measurement is performed differentially in bins of transverse momentum pT for 13 GeV<22 GeV and pT(Bc±)>22 GeV and in bins of rapidity y for |y|<0.75 and 0.75<|y|<2.3. The relative cross section times branching fraction for the full range pT>13 GeV and |y|<2.3 is (0.34±0.04stat -0.02+0.06sys±0.01lifetime)%. The differential measurements suggest that the production cross section of the Bc± decreases faster with pT than the production cross section of the B±, while no significant dependence on rapidity is observed.