Molar mass from gas density calculator
A gas with a density of 1.429 g/L at 1 atm and 273.15 K has a molar mass of about 32 g/mol. Enter density, pressure and temperature in kelvin to identify an unknown gas from a weighed flask. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Density
- 1.429
- Pressure
- 1
- Creativity
- 273.15
- R
- 0.08205746 g/mol
- Molar mass
- 32.0295991394
- Precision
- 10
This molar mass from gas density calculator returns the gas molar mass M in grams per mole from the measured or stated gas density ρ in grams per litre, the absolute pressure P in atmospheres, and the absolute temperature T in kelvin using the ideal gas law rearrangement M equals ρ times R times T divided by P. Density is mass over volume, moles equal mass over molar mass, and substituting into PV equals nRT cancels volume to leave a direct path from ρ, P, and T to M without a molecular formula. The same path appears in general chemistry labs that weigh a flask of unknown gas, in homework that gives density at a stated P and T, and in process checks that convert online density readings into an effective molar mass under ideal assumptions. Typical textbook checks include a density near one point four two nine grams per litre at one atmosphere and two hundred seventy-three point one five kelvin yielding about thirty-two grams per mole, and a lighter gas at the same conditions yielding a smaller M. The engine uses only finite arithmetic with no network calls, no sampling, and no date-dependent shortcuts.
Where density-based molar mass fits in study, lab, and software
Students meet molar mass from gas density when a lab weighs an evacuated flask, fills it with unknown gas at measured P and T, and converts mass over volume into M, when a textbook gives density at STP or room conditions instead of a molecular formula, or when a contest problem asks for M from ρ, P, and T under ideal-gas assumptions. Teachers can pre-generate answer keys for modest densities and known pressures without trusting opaque calculator apps that silently switch between atmospheres and kilopascals or between Celsius and kelvin.
Developers call the same contract from scripts to seed deterministic test vectors for chemistry education products, to normalize user-entered gas-density inputs before reporting molar mass, or to satisfy programming-challenge statements that demand M rather than a hand-waved estimate. Process and quality workflows sometimes need a fast offline source of ideal molar-mass checks so online density readings can be converted without reopening a full thermodynamics package.
Product and tutoring tools use the product when a learner types density, pressure, and temperature and the UI must show a clean g/mol result with a formula echo. Pair it with STP volume and combined gas-law helpers when you are building a small lab of free, deterministic ideal-gas tools that share the same validation style and precision contract.
What you can do with it
Lab unknown gas identification
Convert measured gas density, pressure, and temperature into molar mass for flask labs, unknown identification, and report checks.
Tutoring and chemistry software
Normalize user-entered ρ, P, and T into a stable g/mol result for interactive lessons and gas-law calculators.
FAQ
What does the molar mass from gas density calculator cost?
It is free in your browser on this page.
What happens if pressure is zero?
Zero pressure makes molar mass undefined (division by zero in M = ρRT/P).
Which units should I use for density and temperature?
Density is in g/L and temperature is in kelvin. Pressure is in atmospheres unless you override R to match another consistent unit set.
Can I change the gas constant R?
The default is 0.08205746 L·atm/(mol·K). Zero R is rejected.
What is the molar mass of a gas at 1.429 g/L, 1 atm and 273.15 K?
About 32 g/mol; the exact figure is 32.0295991394 g/mol. Density times the gas constant 0.08205746 times the temperature, divided by the pressure, gives the result.
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/molar-mass-from-gas-density \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"density":1.429,"pressure":1,"temperature":273.15}'const res = await fetch("https://api.kit.forhosting.com/chem/molar-mass-from-gas-density", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"density": 1.429,
"pressure": 1,
"temperature": 273.15
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/chem/molar-mass-from-gas-density",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"density": 1.429,
"pressure": 1,
"temperature": 273.15
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/chem/molar-mass-from-gas-density", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"density":1.429,"pressure":1,"temperature":273.15}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"density":1.429,"pressure":1,"temperature":273.15}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/chem/molar-mass-from-gas-density", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"density": 1.429,
"pressure": 1,
"temperature": 273.15
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "chem.molar_mass_from_gas_density",
"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_value | 1000000000000000 |
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 molar mass from gas density means and what the response contains
Molar mass from gas density is the inverse ideal-gas identity that recovers M when you already know how heavy a gas sample is per unit volume at a known pressure and temperature. Starting from PV equals nRT, write n as mass over M and density ρ as mass over volume; the volume terms cancel and you obtain M equals ρ R T over P. With ρ in grams per litre, P in atmospheres, T in kelvin, and R in litre-atmospheres per mole-kelvin, M is returned in grams per mole, the unit students and lab reports expect for comparison with periodic-table molecular weights. This calculator returns the normalized density, pressure, temperature, and R values, the computed molar_mass, the precision used, the method tag molar_mass_from_gas_density, a short formula reminder, and the unit string g/mol. There is no approximate CAS path and no random sampling: the engine either multiplies three finite scalars and divides by pressure inside the supported magnitude range or rejects the input with invalid_input. Rejected cases include missing density, pressure, or temperature, non-finite values, magnitudes above the documented ceiling, zero pressure because division by zero makes M undefined, non-positive absolute temperature, and negative density.
How density, pressure, temperature, and R are read
Optional leading plus signs and scientific notation on numeric strings are allowed when they parse as finite decimals; embedded spaces, hex prefixes, and non-numeric tokens are rejected with a clear message so a bad cell does not become a wrong molar mass. Temperature must be positive kelvin, and density must be non-negative. The preferred fields are density for ρ in grams per litre, pressure for P in atmospheres, and temperature for T in kelvin, but aliases rho, d, gas_density, and mass_density for density, P, p, pressure_atm, and atm for pressure, and T, temp, temperature_k, and kelvin for temperature are accepted so spreadsheets, query strings, and typed forms can reuse the same contract. Pressure must not be zero: if the absolute value is at or below a tiny epsilon, the request fails with invalid_input because M is undefined when P is zero. An optional R field, with aliases gas_constant, r, and R_gas, overrides the default ideal gas constant of zero point zero eight two zero five seven four six litre-atmospheres per mole-kelvin when your problem statement uses a rounded textbook R such as zero point zero eight two one; zero R is rejected. An optional precision field, with aliases decimals and dp, chooses how many decimal places to expose for the inputs, R, and molar_mass, defaulting to ten and capped at fifteen so JSON goldens stay stable. Pair the free browser run on this page with the priced API when you need the identical mathematical result inside an automated pipeline without re-implementing M equals ρ R T over P yourself.
Where density-based molar mass fits in study, lab, and software
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. That split — free interactive exploration and a priced, identical API — matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the mathematical result.
Integration use cases
Deterministic test fixtures
Generate reproducible molar_mass values for unit tests, property checks, and CI assertions on the ideal-gas density formula.
Technical questions
What formula does this tool use?
M = ρ·R·T/P from the ideal gas law, with ρ in g/L, P in atm, T in K, and default R = 0.08205746 L·atm/(mol·K). M is returned in g/mol.