Graham's law of diffusion calculator
Helium at 4 g/mol diffuses twice as fast as methane at 16 g/mol, because the rate falls with the square root of molar mass. Enter two molar masses in the same unit and get the rate ratio, its inverse and the mass ratio. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Molar mass 1
- 2
- Molar mass 2
- 32
- Mass ratio
- 16
- Rate ratio
- 4
- Inverse rate ratio
- 0.25
Graham's law of diffusion states that the rate at which a gas spreads through another gas or a porous barrier is inversely proportional to the square root of its molar mass. This calculator takes two strictly positive molar masses, M1 and M2, in any consistent unit such as grams per mole, and returns the dimensionless rate ratio rate1 over rate2 equal to the square root of M2 over M1. A textbook check is hydrogen near two grams per mole against oxygen at thirty-two grams per mole, which yields a rate ratio of four: the lighter gas diffuses four times as fast under the same conditions. Zero or negative molar mass is rejected because the inverse-square-root law is undefined for non-positive mass.
What Graham's law of diffusion actually computes
Thomas Graham measured how quickly gases mix through air and through porous plugs and found that the lighter species always outruns the heavier one by a precise factor: the inverse square root of molar mass. Written as rate one over rate two equals the square root of M two over M one, Graham's law of diffusion is the classroom form of that observation.
Kinetic theory explains the same ratio because the root-mean-square speed of an ideal-gas molecule is the square root of three R T over M; at one shared temperature the constants cancel and only the molar-mass ratio survives. Typical homework checks are hydrogen near two grams per mole against oxygen at thirty-two grams per mole, which yields a rate ratio of four, and helium at four grams per mole against methane at sixteen, which yields two. Equal molar masses yield a ratio of one, as they must.
Diffusion in this contract means spreading through another gas or a porous barrier at the same temperature; effusion through a pinhole obeys the identical inverse-square-root formula under the usual idealizations, which is why both names appear on worksheets even though the experimental geometry differs. This calculator does not look up molar masses from chemical formulas, does not convert grams per mole into kilograms per mole, and does not solve Fick's second law through a packed bed.
Homework, lab notes and repeatable answers
Students meet Graham's law of diffusion when a kinetic-molecular chapter asks which gas travels farther in a glass tube in the same time, when an ammonia-and-hydrogen-chloride demonstration forms a white ammonium chloride ring closer to the heavier hydrogen chloride end, or when an exam supplies two molar masses and demands the relative rate without a graphing calculator. Teachers can pre-generate keys for modest mass pairs without trusting opaque apps that invert the numerator or drop the square root.
Lab notes use the same ratio as a sanity check before a full transport model, confirming that helium will out-diffuse nitrogen under equal conditions. Historical enrichment problems, including the qualitative idea behind gaseous diffusion of uranium hexafluoride isotopes, also reduce to the same square-root-of-mass factor once two molar masses are known. Prefer this landing when the search is Graham's law of diffusion and you already have two molar masses; use a dedicated moles-from-mass or formula-weight tool first if you still need those masses from a chemical formula.
What you can do with it
Ammonia–HCl tube and lab intuition
Lab notes estimate how much farther a lighter gas travels in the same time, matching the white-ring demonstration that forms closer to the heavier hydrogen chloride end.
FAQ
Does this cover effusion as well as diffusion?
The experimental geometries differ (mixing through air or a porous barrier versus escape through a pinhole), but the classroom ratio is the same inverse square root of molar mass. This tool returns that shared rate ratio.
How is the diffusion rate ratio calculated?
Divide the second molar mass by the first and take the square root. The answer is how many times faster the first gas spreads than the second; equal molar masses give a ratio of one.
Why does the ammonium chloride ring form near the hydrogen chloride end?
Ammonia is the lighter gas, so it diffuses faster and covers more of the tube before meeting the heavier hydrogen chloride. The white ring therefore appears closer to the hydrogen chloride end.
Can I type a chemical formula instead of a molar mass?
No. The calculator does not look up molar masses from formulas or convert grams per mole into kilograms per mole. Enter both molar masses yourself, in the same unit.
Why does a lighter gas spread faster?
Kinetic theory gives a typical molecular speed of the square root of 3RT over M. At one shared temperature everything cancels except the molar masses, so the lighter molecules move faster on average.
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/grahams-law-of-diffusion \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"molar_mass_1":2,"molar_mass_2":32}'const res = await fetch("https://api.kit.forhosting.com/chem/grahams-law-of-diffusion", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"molar_mass_1": 2,
"molar_mass_2": 32
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/chem/grahams-law-of-diffusion",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"molar_mass_1": 2,
"molar_mass_2": 32
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/chem/grahams-law-of-diffusion", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"molar_mass_1":2,"molar_mass_2":32}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"molar_mass_1":2,"molar_mass_2":32}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/chem/grahams-law-of-diffusion", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"molar_mass_1": 2,
"molar_mass_2": 32
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "chem.grahams_law_of_diffusion",
"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.
Limits
max_abs | 1000000000000 |
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
What Graham's law of diffusion actually computes
It evaluates the two-mass ratio that answer keys expect, with fixed rounding so a browser run and an API call never disagree on the twelfth decimal of the published rate ratio.
Inputs, outputs, and the non-positive mass error
Zero and negative molar masses are rejected because Graham's law places mass under a square root and a non-positive mass would make the ratio undefined or unphysical; those failures are not billed. Units are the caller's responsibility: mixing grams per mole with kilograms per mole would scale the ratio incorrectly, and this tool never converts. POST a JSON body with two required finite numbers: molar_mass_1 for M1 of the first gas and molar_mass_2 for M2 of the second, in any consistent molar-mass unit such as grams per mole. Aliases M1, m1, mass1, and molarMass1 are accepted for the first field, and M2, m2, mass2, and molarMass2 for the second, so spreadsheets and typed forms can reuse the same contract. Each value must be strictly positive and within an absolute magnitude of one trillion; missing fields, empty strings, non-numeric tokens, infinities, and NaN fail with invalid_input naming the field. On success the body echoes the rounded molar masses, sets mass_ratio to M2 divided by M1, sets rate_ratio to the square root of that mass ratio which is the primary Graham rate of gas one relative to gas two, sets inverse_rate_ratio to the reciprocal, and restates the formula as rate1 over rate2 equals the square root of M2 over M1. Numeric fields are rounded to twelve decimal places so Worker and browser JSON stay byte-stable across runtimes.
Homework, lab notes, and reproducible API fixtures
On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns.
Integration use cases
Homework checks for relative diffusion rates
Students enter textbook molar masses for two gases and compare a handwritten rate1/rate2 against a deterministic JSON result before submitting kinetic-theory homework.
Deterministic fixtures for chemistry software
Generate known-good Graham rate ratios plus deliberate zero-mass rejections for coding kata expected values, dashboards, and continuous-integration checks.
Technical questions
How is the Graham diffusion rate ratio computed?
Graham's law says rate1/rate2 = √(M2/M1). Enter two positive molar masses in the same unit; the response field rate_ratio is that square-root value, and inverse_rate_ratio is the reciprocal.
Do molar_mass_1 and molar_mass_2 need the same units?
Yes. Use any consistent molar-mass unit (g/mol or kg/mol) for both fields. Only the mass ratio enters the square root, so mixing units would scale the answer incorrectly.
What happens if a molar mass is zero or negative?
The request fails with invalid_input. Graham's law is undefined for non-positive molar mass, so the API never returns NaN, Infinity, or a silent nonsense ratio.
Is the Graham's law of diffusion calculator free?
The browser runner is free and executes locally. API calls use prepaid balance at $0.002 per successful request; failed tasks that return invalid_input are never charged.