Mixing ratio calculator
A vapor pressure of 12.27 hPa at a total pressure of 1013.25 hPa gives 7.624468021339 g of water vapor per kilogram of dry air. Enter both pressures in the same unit and get the mixing ratio in g/kg and kg/kg. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Vapor pressure
- 12.27
- Total pressure
- 1,013.25
- Mixing ratio
- 7.6244680213 g/kg
- Mixing ratio kg kg
- 0.007624468
- Dry air pressure
- 1,000.98
- Epsilon
- 0.622
A mixing ratio calculator turns the partial pressure of water vapor and the total atmospheric pressure into the mass of water vapor per kilogram of dry air. Enter a finite vapor pressure e and a strictly positive total pressure P in the same unit—hectopascals, millibars, pascals, or torr all work because only the ratio of the two pressures enters the formula. The tool applies the standard meteorological identity w equals 622 times e divided by P minus e, echoes the cleaned inputs, and returns the mixing ratio in grams per kilogram plus the equivalent kilogram-per-kilogram value.
What the mixing ratio means and its formula
Mixing ratio, also called the humidity mixing ratio in meteorology and the humidity ratio in psychrometrics, is the mass of water vapor divided by the mass of dry air in the same parcel. It is not relative humidity, which is a percentage of saturation at a given temperature, and it is not specific humidity, which divides vapor mass by the mass of the moist mixture rather than by dry air alone. For an ideal-gas mixture the definition becomes a closed form in pressures.
Let e be the partial pressure of water vapor and P the total atmospheric pressure, both in the same unit. Dry-air partial pressure is then P minus e. The molecular-weight ratio of water vapor to dry air is ε approximately 0.622, so the mass ratio is w equals ε times e divided by P minus e kilograms of vapor per kilogram of dry air.
Because e and P appear only as a ratio, hectopascals, millibars, pascals, and torr all produce the same mixing ratio provided both inputs share one unit. A typical station reading of vapor pressure 12.27 hectopascals at 1013.25 hectopascals yields a mixing ratio of a few grams per kilogram, the same order as mid-latitude surface air. Zero vapor pressure yields a mixing ratio of zero—perfectly dry air.
If vapor pressure meets or exceeds total pressure, the dry-air remainder is not positive and the identity is undefined, so this calculator rejects that case rather than returning Infinity.
Where the mixing ratio helps, and what it is not
Synoptic and mesoscale notebooks convert radiosonde or reanalysis vapor pressure and station pressure into mixing ratio so that conserved moisture can be compared across height without repeating the ε identity by hand. Chemistry and atmospheric-science courses assign the same closed form as a first humidity lab: given e and P, report w in grams per kilogram and show the substitution. HVAC and psychrometric spreadsheets need a deterministic oracle that matches the mass-of-vapor-per-mass-of-dry-air definition used on psychrometric charts, not a relative-humidity percentage that still depends on temperature.
Environmental monitoring scripts fold mixing ratio into emission and deposition calculations where a mass ratio is the natural unit. Prefer this capability when you already have vapor pressure and total pressure and only need w; if you already know the mixing ratio and merely need another unit such as grains per pound, use a humidity-ratio unit converter instead of this calculator. If you have actual and saturation vapor pressure and need a percentage, that is relative humidity, a different search.
What you can do with it
Radiosonde and station moisture
Convert observed vapor pressure and station or mean-sea-level pressure into mixing ratio in g/kg for soundings, reanalysis intercomparison, and conserved-moisture diagnostics.
HVAC and psychrometric mass ratio
Obtain the humidity mixing ratio in grams per kilogram of dry air from vapor and total pressure before looking up grains per pound or plotting a psychrometric chart.
FAQ
How is mixing ratio calculated from vapor pressure and total pressure?
The mass mixing ratio of water vapor in dry air is w = ε·e/(P−e) kg/kg with ε = 0.622. Vapor pressure e and total pressure P must use the same unit.
What happens if total pressure is zero or negative?
Mixing ratio is undefined when total atmospheric pressure is not positive, and the failure is not billed.
Is mixing ratio the same as relative humidity or specific humidity?
No. Mixing ratio is mass of water vapor per mass of dry air. Specific humidity divides by the mass of the moist mixture. Relative humidity is a percentage of saturation vapor pressure at a given temperature and is not what this tool returns.
Which pressure unit should I use for e and P?
Any consistent unit: hPa, mbar, Pa, torr, or another pressure unit.
What happens if the vapor pressure is equal to or higher than the total pressure?
The calculator rejects it. The dry air is what remains after subtracting the vapor pressure from the total, and if nothing positive is left the mixing ratio is undefined rather than infinite.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/chem/mixing-ratio \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"vapor_pressure":12.27,"total_pressure":1013.25}'const res = await fetch("https://api.kit.forhosting.com/chem/mixing-ratio", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"vapor_pressure": 12.27,
"total_pressure": 1013.25
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/chem/mixing-ratio",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"vapor_pressure": 12.27,
"total_pressure": 1013.25
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/chem/mixing-ratio", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"vapor_pressure":12.27,"total_pressure":1013.25}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"vapor_pressure":12.27,"total_pressure":1013.25}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/chem/mixing-ratio", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"vapor_pressure": 12.27,
"total_pressure": 1013.25
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "chem.mixing_ratio",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
When total pressure is zero or negative the mixing ratio is undefined, so the request fails with invalid_input instead of dividing by a non-physical atmosphere.
What mixing ratio means and how w = 622·e/(P−e) is derived
Multiply by one thousand to report grams per kilogram, which is the everyday meteorological unit on sounding plots, model output, and lab notebooks: w_gkg equals 1000 times ε times e over P minus e, or simply 622 times e over P minus e when ε is taken as 0.622. Total pressure itself must be strictly positive: a zero or negative atmosphere is not a physical denominator and is the explicit invalid_input path documented for this landing.
Input contract, response shape, units, and error behaviour
Vapor pressure must be non-negative and strictly less than total pressure so that P minus e stays positive. Classic checks include vapor pressure 12.27 and total pressure 1013.25 for a surface-air example, vapor pressure 10 and total pressure 1000 for a round-number textbook drill, and vapor pressure 0 at any positive P for bone-dry air. Send a JSON body with two required finite numbers: vapor_pressure, the partial pressure of water vapor e, with aliases e, pv, partial_pressure, water_vapor_pressure, and vapor; and total_pressure, the total atmospheric pressure P, with aliases p, pressure, atmospheric_pressure, air_pressure, and station_pressure. Both may arrive as JSON numbers or as strict numeric strings. Total pressure must be strictly greater than zero; zero and negative values fail with invalid_input and a message that total pressure must be positive, and those failures are not billed. Missing fields, empty strings, NaN, Infinity, and magnitudes beyond the published absolute limit of one trillion also fail with invalid_input naming the field. On success the body echoes rounded vapor_pressure and total_pressure, returns mixing_ratio as the primary result in grams per kilogram, mixing_ratio_kg_kg as the SI mass ratio, dry_air_pressure as P minus e in the input pressure unit, epsilon as 0.622, formula as the short identity string, unit as g/kg, plus equation and message lines you can paste into a lab report. This endpoint does not convert mixing-ratio units, does not compute relative humidity, and does not invert temperature to saturation vapor pressure—those are separate landings.
Where a mixing-ratio API earns its keep, and what it is not
Pin the rounded mixing_ratio in tests, keep both pressures in one unit, and you get reproducible grams per kilogram for homework, LMS plugins, and edge workers without standing up a psychrometric library of your own.
Integration use cases
Chemistry and meteorology homework
Check w = 622·e/(P−e) for textbook pairs of e and P, including the dry-air limit e = 0 and the invalid_input path when total pressure is not positive.
Technical questions
What does the mixing ratio calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.