A measurement of the mass of the W boson is presented based on protonâproton collision data recorded in 2011 at a centre-of-mass energy of 7 TeV with the ATLAS detector at the LHC, and corresponding to 4.6fb-1 of integrated luminosity. The selected data sample consists of 7.8 Ã 106candidates in the Wâ Î¼Î½ channel and 5.9 Ã 106candidates in the Wâ eÎ½ channel. The W-boson mass is obtained from template fits to the reconstructed distributions of the charged lepton transverse momentum and of the W boson transverse mass in the electron and muon decay channels, yielding (Formula presented.) where the first uncertainty is statistical, the second corresponds to the experimental systematic uncertainty, and the third to the physics-modelling systematic uncertainty. A measurement of the mass difference between the W+and W-bosons yields mW+-mW-=-29Â±28Â MeV.