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.6
fb
-
1
of integrated luminosity. The selected data sample consists of
7.8
×
10
6
candidates in the
W
→
μ
ν
channel and
5.9
×
10
6
candidates 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
m
W
=
80370
±
7
(
stat.
)
±
11
(
exp. syst.
)
±
14
(
mod. syst.
)
MeV
=
80370
±
19
MeV
,
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
m
W
+
-
m
W
-
=
-
29
±
28
MeV