We perform both first-principles calculations and kinetic Monte Carlo (kMC) simulations to study the diffusion and thermal stability of hydrogen in ZnO. The migration energy of a substitutional hydrogen (H(O)) is 1.7 eV, much higher than the value of 0.4-0.5 eV for an interstitial hydrogen (H(i)). Using as input the calculated energy barriers for H diffusion, kMC simulations show that while H(i) diffuses out at low temperature, the thermal stability of H(O) is maintained up to 475 degrees C, in good agreement with the annealing data. In addition, our calculations suggest that injected hydrogen from air turns into H(O), causing n-type conductivity. (C) 2008 American Institute of Physics.