The production of B± mesons is studied in pp collisions at centre-of-mass energies of 7 and 13 TeV, using B± → J/ψ K± decays and data samples corresponding to 1.0 fb−1 and 0.3 fb−1, respectively. The production cross-sections summed over both charges and integrated over the transverse momentum range 0 < pT < 40 GeV/c and the rapidity range 2.0 < y < 4.5 are measured to beσ(pp→B±X,s=7TeV)=43.0±0.2±2.5±1.7μb,σ(pp→B±X,s=13TeV)=86.6±0.5±5.4±3.4μb,where the first uncertainties are statistical, the second are systematic, and the third are due to the limited knowledge of the B± → J/ψ K± branching fraction. The ratio of the cross-section at 13 TeV to that at 7 TeV is determined to be 2.02 ± 0.02 (stat) ± 0.12 (syst). Differential cross-sections are also reported as functions of pT and y. All results are in agreement with theoretical calculations based on the state-of-art fixed next-to-leading order quantum chromodynamics.