Rate constants are calculated for the reactions D + H2→DH + H and H + D2→HD + D and compared to measured values. An accurate potential energy surface, based on the ab initio calculations of Liu and Siegbahn, was used. Rates were calculated using both conventional transition state theory and canonical variational theory. In the former, the generalized transition state dividing surface is located at the saddle point; in the latter it is located to maximize the generalized free energy of activation. We show that, in the absence of tunneling corrections, locating the generalized- transition-state dividing surface variationally has an important quantitative effect on the predicted rate constants for these systems and that, when tunneling is included, most of the effect of using a better dividing surface can be included in conventional transition state theory for these systems by using a consistent transmission coefficient for quantal scattering by the vibrationally adiabatic potential energy curve. Tunneling effects are important for these reactions even for temperatures larger than 400 K. We show how to separate classical recrossing effects from quantal corrections on reaction-coordinate motion in both the transmission coefficients and the kinetic isotope effects. Our most complete calculations are in excellent agreement with most of the measured rate constants and kinetic isotope effects.