We have studied the formation energy of the simplest oxygen defects in alpha-quartz, the oxygen vacancy and interstitial, by an ab initio approach based on density functional theory in the local density approximation. We have determined the formation energies and entropies and the migration paths and energies. From our results we can conclude that oxygen diffuses in quartz by an interstitial mechanism: the interstitial has a dumbbell structure; one of the constitutive atoms jumps towards a neighboring oxygen site. The activation energy amounts to 4.7 eV in the intrinsic regime and 2.8 eV in the extrinsic regime.