Vapor phase composition calculator
An ideal liquid that is 0.6 component 1 and 0.4 component 2, with pure vapor pressures of 100 and 50, makes a vapor that is 0.75 component 1. Enter both liquid fractions and pure vapor pressures for the partial pressures, total and vapor fractions. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- X1
- 0.6
- X2
- 0.4
- P1 sat
- 100
- P2 sat
- 50
- Partial pressure 1
- 60
- Partial pressure 2
- 20
- Total pressure
- 80
- Y1
- 0.75
Vapor-phase composition is the set of mole fractions in the gas that coexists with a liquid mixture at equilibrium. For an ideal binary liquid, Raoult's law multiplies each liquid mole fraction by that component's pure vapor pressure, sums those partial pressures into a total pressure, and divides each partial pressure by the total to obtain y1 and y2. When total pressure is zero, the response is a clear invalid input error rather than a silent divide-by-zero.
What the vapor above a liquid mixture contains
When a liquid mixture sits in a closed space, part of each component evaporates until the gas above it is in equilibrium with the liquid. For an ideal two-component liquid, Raoult's law says each component contributes a partial pressure equal to its liquid mole fraction times its pure vapor pressure at that temperature. Adding the two partial pressures gives the total pressure, and dividing each one by the total gives the vapor mole fractions. With a liquid of 0.6 and 0.4 and pure pressures of 100 and 50, the partial pressures are 60 and 20, the total is 80, and the vapor holds 0.75 and 0.25.
Mistakes to avoid with Raoult's law
The pure vapor pressures must belong to the system temperature, because the tool does not look them up or apply Antoine constants for you. Both must use the same unit, whether kilopascals, bars, atmospheres or torr, so that the vapor fractions stay dimensionless. Each liquid fraction must lie between zero and one, and together they cannot go above one. If both pure pressures are zero there is no vapor to describe, and you get a clear message instead of a division by zero. The model is ideal and limited to two components.
FAQ
Must x1 and x2 sum to one?
They must not exceed one. A sum below one is allowed when you model a partial binary basis; only the two given components contribute to P and to y1, y2.
Is the vapor phase composition calculator free?
The browser tool runs free on your device.
Does this support non-ideal mixtures or more than two components?
No. This product is the ideal binary Raoult solve from liquid mole fractions and pure vapor pressures. Activity coefficients and multi-component systems are out of scope.
How do I find the vapor composition with Raoult's law?
Multiply each liquid mole fraction by that component's pure vapor pressure, add the two results for the total pressure, then divide each partial pressure by the total. With 0.6 and 0.4 at 100 and 50, you get 60, 20 and 80.
Why is the vapor richer in the more volatile component?
Because its partial pressure takes a larger share of the total. In the example, component 1 makes up 0.6 of the liquid but 0.75 of the vapor, since its pure vapor pressure is twice as high.
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/vapor-phase-composition \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"x1":0.6,"x2":0.4,"p1_sat":100,"p2_sat":50}'const res = await fetch("https://api.kit.forhosting.com/chem/vapor-phase-composition", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"x1": 0.6,
"x2": 0.4,
"p1_sat": 100,
"p2_sat": 50
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/chem/vapor-phase-composition",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"x1": 0.6,
"x2": 0.4,
"p1_sat": 100,
"p2_sat": 50
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/chem/vapor-phase-composition", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"x1":0.6,"x2":0.4,"p1_sat":100,"p2_sat":50}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"x1":0.6,"x2":0.4,"p1_sat":100,"p2_sat":50}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/chem/vapor-phase-composition", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"x1": 0.6,
"x2": 0.4,
"p1_sat": 100,
"p2_sat": 50
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "chem.vapor_phase_composition",
"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
Raoult inputs: liquid mole fractions and pure vapor pressures
Model a two-component ideal liquid as open system equilibrium where each component contributes a partial pressure equal to its liquid mole fraction times its pure vapor pressure at the system temperature. Liquid fractions that sum above one fail validation because a binary basis cannot exceed a full mole. The engine does not look up Antoine constants or convert units: you supply P_i^sat already evaluated at the temperature of interest. Send x1 and x2 as finite numbers in the closed interval from zero to one; optional aliases mole_fraction_1, liquid_mole_fraction_1, and x_1 map to the first component, with the parallel aliases for component two. Pure vapor pressures p1_sat and p2_sat must be non-negative finite numbers in any coherent pressure unit—kilopascals, bars, atmospheres, or torr—as long as both pressures share that unit so the total pressure and the vapor fractions stay dimensionless and consistent. Numeric strings are accepted and coerced the same way as JSON numbers. Values outside zero to one, missing fields, non-finite magnitudes, and negative pure pressures all raise invalid_input and are not charged. Identical inputs always produce identical JSON because the path is pure arithmetic with no network, no random seed, and no wall clock, which makes the vapor phase composition calculator safe to pin in automated tests and classroom oracles.
Reading y1, y2, partial pressures, and the total pressure
On success the response echoes x1, x2, p1_sat, and p2_sat after stable rounding, then reports partial_pressure_1 equal to x1 times p1_sat and partial_pressure_2 equal to x2 times p2_sat. The total_pressure field is the sum of those two partial pressures and is the denominator used for vapor fractions. Fields y1 and y2 are the vapor-phase mole fractions; vapor_mole_fractions repeats them as a nested object for clients that prefer a single map. The formula label is always y_i equals x_i times P_i_sat over P, and method is always raoult_vapor_phase_composition so downstream code can branch without sniffing shapes. When both pure vapor pressures are zero, or when both liquid contributions vanish so the sum is exactly zero, the engine refuses the request with invalid_input and a message that states total pressure is zero and vapor-phase mole fractions are undefined—this is the product contract for the zero-pressure edge case rather than returning NaN or infinity. Use partial pressures when you need Dalton-style intermediates for a report; use y1 and y2 alone when a distillation sketch only needs vapor composition; use total_pressure when checking that bubble-point pressure matches a lab measurement in the same units as the pure pressures you supplied.
API usage, pricing, classroom workflows, and practical limits
Call the free in-browser vapor phase composition calculator for homework checks, lecture demos, and quick VLE mental math without installing Aspen, CoolProp, or a local process simulator. Authors shipping SDKs can map y1 and y2 directly into UI tables next to liquid x1 and x2—the same side-by-side layout students draw when they apply Raoult's law by hand on a binary Txy or Pxy sketch. Send a JSON body with the four required fields x1, x2, p1_sat, and p2_sat (or their documented aliases). Use the prepaid API when a tutoring platform, lab notebook service, chemical engineering pipeline, or assessment sandbox needs a stable contract under KIT balance at $0.002 per successful item; validation failures never consume balance after the engine rejects the request. Pair this endpoint with a partial-pressure tool when you already know gas mole fractions and total pressure, or with equilibrium-constant utilities when the next step is reaction extents rather than phase split. Keep pure pressures non-negative and within the published magnitude bounds so Worker isolates stay safe.
Integration use cases
Binary VLE homework and exams
Students enter liquid mole fractions and pure vapor pressures, read y1 and y2, and get a clear invalid_input error when total pressure is zero instead of a cryptic divide-by-zero.
Tutoring and curriculum generators
Lesson builders produce worked Raoult vapor-composition examples with structured JSON for flashcards, step sheets, and auto-graded drills without embedding a process simulator.
Lightweight process and lab pipelines
Scripts that need ideal binary vapor mole fractions from measured or tabulated Psat values call a stable prepaid endpoint instead of reimplementing y_i = x_i·Psat_i / P in every language.
Technical questions
How do I compute vapor-phase mole fractions with this calculator?
Send JSON with x1, x2, p1_sat, and p2_sat. The response includes partial pressures, total_pressure, y1, and y2 by Raoult's law (y_i = x_i·P_i^sat / P).
What happens when total pressure is zero?
The request fails with invalid_input. If the sum of x_i·P_i^sat is zero, vapor-phase mole fractions are undefined and the engine refuses the divide rather than returning NaN.