We report the results of ab Initio density functional theory calculations o
f the NMR chemical shift of liquid water and hexagonal ice. Depending on th
e structural model used, the calculated isotropic shift of ice Ih with resp
ect to the gas phase is -8.0 +/- 0.2 or -8.1 +/- 0.1 ppm for the proton, an
d -48.6 +/- 0.02 or -48.1 +/- 0.02 ppm for oxygen. The proton anisotropy is
-33.4 +/- 0.2 or -33.6 +/- 0.2 ppm. Using snapshots from ab initio molecul
ar dynamics simulations, we find a gas-to-liquid shift of -5.8 +/- 0.1 ppm
for hydrogen, and -36.6 +/- 0.5 ppm for oxygen. Molecules beyond the first
solvation shell influence the proton chemical shift predominantly via the e
lectric field generated by their permanent electric dipole moment. Finally,
we show that it is possible to reproduce the proton chemical shifts in the
condensed phases by an empirical function of the local molecular geometry.