ForHosting KIT · Science

Relative humidity from specific humidity

At sea level, a specific humidity of 0.0072 kg/kg at 20 °C and 1013.25 hPa means a vapor pressure near 11.7 hPa against a saturation pressure near 23.4 hPa: relative humidity of about fifty percent. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Specific humidity
0.0072
Creativity
20
Pressure
1,013.25
You get
Vapor pressure
11.6778417778 %
Saturation vapor pressure
23.3694712341
Relative humidity
49.9705006625
Rh
49.9705006625

Relative humidity is the everyday percentage people mean when they ask how muggy the air feels, yet many atmospheric datasets and numerical weather models store moisture as specific humidity—the mass of water vapor per unit mass of moist air—together with temperature and pressure. Converting those three numbers into RH requires a vapor-pressure ratio: first recover the actual vapor pressure e from the mass fraction q and total pressure P, then divide by the saturation vapor pressure es at the same temperature. This relative humidity from specific humidity calculator performs that conversion with a fixed ε = 0.622 mass-ratio constant and the Magnus–Tetens formula for es, returning RH as a percentage with intermediate pressures for audit trails.

What specific humidity means and how RH is recovered from vapor-pressure ratios

Specific humidity q is the mass fraction of water vapor in moist air: kilograms of vapor per kilogram of the mixture. It is conserved under simple expansion and compression more cleanly than mixing ratio or dew point, which is why climate models, radiosonde archives, and reanalysis products often publish q rather than relative humidity. To bridge the two, first invert the standard mass-fraction relation.

With ε ≈ 0.622 equal to the molecular-weight ratio of water vapor to dry air, the identity q = ε · e / (P − (1 − ε) · e) rearranges to e = q · P / (ε + (1 − ε) · q). That e must share the pressure unit of the total pressure P you supply. Dividing the two pressures and scaling by one hundred yields RH in percent.

Values above one hundred percent are reported when the implied vapor pressure exceeds saturation (supersaturation or slightly inconsistent inputs); they are not silently capped, so automated pipelines can detect over-saturation instead of masking it. When q is zero, e is zero and RH is zero.

What to enter, units and how results read

Total pressure must be strictly greater than zero: zero or negative pressure makes e undefined or non-physical and is always rejected with a clear message that relative humidity from specific humidity is undefined in that case—those failures are not billed. Specific humidity must lie in [0, 1). The epsilon field restates the 0.622 constant, formula summarizes the three-step identity, and unit is the percent sign.

Example near sea level: q equals 0.0072 kilograms per kilogram, T equals 20 degrees Celsius, P equals 1013.25 hectopascals yields a vapor pressure near 11.7 hectopascals, a saturation pressure near 23.4 hectopascals, and RH near fifty percent. Keep P and es in the same unit family by always sending pressure in hPa when using the built-in Magnus constants; do not mix pascals with hectopascals.

Reanalysis and model post-processing

Convert gridded specific humidity, temperature, and pressure fields into relative humidity for diagnostics and comparison with surface observations.

Psychrometrics labs and homework

Let students verify that e from q and P, divided by Magnus–Tetens es(T), recovers the expected RH percentage.

HVAC and indoor air dashboards

Turn mass-fraction humidity sensors plus station pressure and dry-bulb temperature into an RH percent for comfort alerts.

What happens if pressure is zero or negative?

Relative humidity from specific humidity is undefined when total pressure is zero or negative, and the failure is not billed.

Which units does the calculator expect?

Specific humidity as a dimensionless mass fraction (kg/kg), temperature in degrees Celsius, and pressure in hectopascals (hPa / mbar) so it matches the Magnus–Tetens es output.

Can relative humidity exceed 100%?

Yes. If the vapor pressure implied by q and P exceeds saturation at T, RH above 100% is reported (supersaturation or inconsistent inputs) rather than silently capped.

Which formula gives the saturation vapor pressure?

The Magnus–Tetens expression over liquid water: 6.112 hPa times the exponential of 17.67 times the temperature divided by the temperature plus 243.5, with temperature in degrees Celsius. Keep pressure in hPa so both pressures share a unit.

Why does the calculator need the air pressure?

Specific humidity is a mass fraction, so the actual vapor pressure depends on the total pressure around it. The calculator recovers that vapor pressure from humidity and pressure using the 0.622 ratio, then divides it by the saturation value.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/earth/relative-humidity-specific

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/earth/relative-humidity-specific \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"specific_humidity":0.0072,"temperature":20,"pressure":1013.25}'
{
  "specific_humidity": 0.0072,
  "temperature": 20,
  "pressure": 1013.25
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "earth.relative_humidity_specific",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Zero or negative total pressure is rejected as invalid_input because the vapor-pressure identity is undefined in that regime.

What specific humidity means and how RH is recovered from vapor-pressure ratios

Relative humidity, by contrast, is a ratio of partial pressures at a fixed temperature: RH = 100 · e / es, where e is the actual vapor pressure of water and es is the saturation vapor pressure at the same dry-bulb temperature. Saturation vapor pressure is then evaluated with the Magnus–Tetens expression over liquid water, es = 6.112 · exp(17.67 · T / (T + 243.5)) in hectopascals when T is in degrees Celsius—the same unit family expected for station pressure in meteorology. When q approaches one, the mixture is almost pure vapor and the formula remains mathematically defined only while the denominator stays positive, which is why the API requires q in the half-open interval from zero inclusive to one exclusive.

Input contract, units, response fields, and error behaviour

POST a JSON body with three required finite numbers: specific_humidity (aliases q, humidity_specific, sh, specific_hum) as a mass fraction in kilograms per kilogram, temperature (aliases temp, temp_c, t, temperature_c, air_temp) in degrees Celsius for Magnus–Tetens, and pressure (aliases p, pressure_hpa, total_pressure, air_pressure, station_pressure) as total air pressure in hectopascals or millibars. Fields may arrive as JSON numbers or numeric strings; missing fields, empty strings, and non-finite values fail with invalid_input naming the field. On success the body echoes the rounded inputs, reports vapor_pressure e and saturation_vapor_pressure es in hPa, and returns relative_humidity together with rh and percent aliases all equal to RH rounded to twelve decimal places for stable goldens across runtimes. Pair the response with your own unit converters if your archive stores Pa or inHg—this endpoint does not convert pressure units beyond the analytic path described.

Where a relative humidity from specific humidity API earns its keep

Meteorology labs and university courses that teach psychrometrics need a deterministic oracle so students can check hand calculations that start from model-style specific humidity rather than from wet-bulb readings. HVAC and indoor-air scripts that receive absolute humidity sensors reporting mass fraction can convert to RH for comfort dashboards without standing up a full thermodynamic library. Climate and reanalysis post-processing pipelines often hold 3-D fields of q, T, and P and must emit RH for diagnostics, moisture-advection studies, or comparison against surface observations; calling a tiny parse API avoids re-implementing ε and Magnus constants in every language of the stack. Failed validation—especially the zero or negative pressure case—does not consume balance, so health checks that probe bad payloads stay cheap.

How do I compute relative humidity from specific humidity?

Send specific_humidity q (kg/kg in [0,1)), temperature in °C, and total pressure in hPa. The API forms e = q·P/(ε+(1−ε)·q) with ε=0.622, es from Magnus–Tetens, and returns RH = 100·e/es.

What does the relative humidity from specific humidity calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →