The one that does not move

Every other humidity figure on this site changes when you do nothing but change the temperature. Relative humidity changes because the denominator moves. Absolute humidity in g/m³ changes because the air expands and the same water occupies more cubic metres. Even the dew point shifts a little if a parcel is compressed.

The mixing ratio does not. Warm a sealed parcel of air, cool it, carry it up a mountain — as long as no water condenses out and none is added, the grams of water per kilogram of dry air is exactly what it was. That conservation is the entire reason the figure exists.

w = 621.97 × e / (p − e) e is the vapour pressure, p the station pressure, both in hectopascals. Result in g/kg.

Seeing the conservation

Take air with a 60°F dew point and warm it through a normal day. The percentage collapses, the density drifts down as the air expands, and the mixing ratio does not move at all:

One parcel of air, warmed. Only the mixing ratio is a property of the air rather than of the air-at-this-temperature.
TemperatureRelative humidityDensityMixing ratio
60°F / 15.6°C100%13.2 g/m³11.02 g/kg
70°F / 21.1°C71%13.0 g/m³11.02 g/kg
80°F / 26.7°C51%12.7 g/m³11.02 g/kg
90°F / 32.2°C37%12.5 g/m³11.02 g/kg

The pressure input

This is the only calculator on the site that asks for a pressure, and it is worth being precise about which one.

Weather reports quote sea-level pressure — the station reading adjusted upward as if the station were at sea level — so that maps of pressure show weather systems rather than terrain. What this formula needs is station pressure, the actual pressure of the actual air.

At sea level they are the same. In Denver, at 1,600 m, station pressure runs near 840 hPa while the reported figure is near 1013. Using the reported one there would understate the mixing ratio by about 17%. If you are not sure which you have and you are near sea level, the default is fine; if you are at altitude, it matters.

Specific humidity, briefly

The readout beside the answer is specific humidity: the same water, divided by the mass of all the air rather than just the dry part. Since vapour is at most a few percent of the total,

q ≈ w / (1 + w/1000) which for 11.02 g/kg gives 10.90 g/kg — a difference of about 1.1%.

Both are conserved in the same way, and outside of thermodynamics work the distinction rarely changes an answer. The specific humidity guide covers when it does.