We have studied deuterium fractionation on interstellar grains with the use of an exact method known as the direct master equation approach. We consider conditions pertinent to dense clouds at late times when the hydrogen is mostly in molecular form and a large portion of the gas-phase carbon has already been converted to carbon monoxide. Hydrogen, oxygen and deuterium atoms, as well as CO molecules, are allowed to accrete on to dust particles and react there to produce various stable molecules. The surface abundances, as well as the abundance ratios between deuterated and normal isotopomers, are compared with those calculated with the Monte Carlo approach. We find that the agreement between the Monte Carlo and the direct master equation methods can be made as close as desired. Compared with previous examples of the use of the direct master equation approach, our present method is much more efficient. It should now be possible to run large-scale gas–grain models in which the diffusive dust chemistry is handled ‘exactly’.