Context. Protoplanetary disks around young stars are the sites of planet formation. While the dust mass can be estimated using standard methods, determining the gas mass -and thus the amount of material available to form giant planets -has proven to be very difficult. Hydrogen deuteride (HD) is a promising alternative to the commonly-used gas mass tracer, carbon monoxide. However, its potential has not yet been investigated with models incorporating both HD and CO isotopologue-specific chemistry, and its sensitivity to uncertainties in disk parameters has not yet been quantified. Aims. To examine the robustness of HD as tracer of the disk gas mass, specifically the effect of gas mass on the HD far infrared emission and its sensitivity to the vertical structure. Also, to provide requirements for future far-infrared missions such as SPICA. Methods. Deuterium chemistry reactions relevant for HD were implemented in the thermochemical code DALI and more than 160 disk models were run for a range of disk masses and vertical structures. Results. The HD J=1-0 line intensity depends directly on the gas mass through a sublinear power law relation with a slope of ∼0.8. Assuming no prior knowledge about the vertical structure of a disk and using only the HD 1-0 flux, gas masses can be estimated to within a factor of two for low mass disks (M disk ≤ 10 −3 M ). For more massive disks, this uncertainty increases to more than an order of magnitude. Adding the HD 2-1 line or independent information about the vertical structure can reduce this uncertainty to a factor of ∼ 3 for all disk masses. For TW Hya, using the radial and vertical structure from Kama et al. (2016b) the observations constrain the gas mass to 6 · 10 −3 M ≤ M disk ≤ 9 · 10 −3 M . Future observations require a 5σ sensitivity of 1.8 · 10 −20 W m −2 (2.5 · 10 −20 W m −2 ) and a spectral resolving power R ≥ 300 (1000) to detect HD 1-0 (HD 2-1) for all disk masses above 10 −5 M with a line-to-continuum ratio ≥ 0.01. Conclusions. These results show that HD can be used as an independent gas mass tracer with a relatively low uncertainty and should be considered as an important science goal for future far-infrared missions.