A study of the decays B0s→ μ+μ− and B0 →μ+μ− has been performed using data corresponding to an integrated luminosity of 25 fb−1 of 7 and 8 TeV proton–proton collisions collected with the ATLAS detector during the LHC Run 1. For the B0 dimuon decay, an upper limit on the branching fraction is set at B(B0 → μ+μ−) <4.2×10−10 at 95% confidence level. For B0s , the branching fraction B(B0s→ μ+μ−) = (0.9+1.1−0.8) ×10−9 is measured. The results are consistent with the Standard Model expectation with a p value of 4.8%, corresponding to 2.0 standard deviations.