Dew point calculator: from temperature and relative humidity
The dew point is the temperature at which air becomes saturated with water vapour and water starts to condense. Enter temperature and relative humidity, or temperature and dew point, and get the rest of the humid air properties.
p_w = RH · p_s(T), p_s(T_d) = p_w
What the dew point is
Cool air without changing how much water it holds, and its relative humidity rises. At the dew point it reaches 100% and water starts to condense: on a cold glass, on a window in winter, inside an air-conditioning duct. The higher the dew point, the more water the air holds.
Below 0 °C the vapour turns straight to frost, so there the calculator gives the frost point, computed over ice.
Example
Air at 25 °C and 60% relative humidity has a dew point of 16.7 °C. Any surface colder than that, such as a chilled water pipe, will sweat. The absolute humidity is 13.9 g/m³, the humidity ratio 11.9 g/kg and the wet-bulb temperature 19.5 °C.
About the calculation
The saturation vapour pressure comes from IAPWS-IF97 over water and the IAPWS sublimation equation over ice. Humidity ratio, enthalpy and wet bulb come from the ASHRAE equations, with the Buck enhancement factor for water vapour in air. In the tests, the saturated humidity ratio matches the ASHRAE tables to within 0.03% from −20 °C to 25 °C.
Altitude changes the pressure, so it changes the humidity ratio and the wet bulb, but hardly the dew point. The code is open source on GitHub and npm as psychrometrics.