Gas density at STP calculator
Get a gas's density at standard conditions from its molar mass alone: dry air at 28.97 g/mol comes to about 1.3 kg/m³ at 0 °C and 1 atm, the same figure in grams per litre. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Molar mass
- 28.97
- Molar mass kg per mol
- 0.02897
- Temperature stp
- 273.15
- Pressure stp
- 101,325
- Resistance (Ω)
- 8.314462618
Standard temperature and pressure give a shared reference state so students and lab workflows can compare gas densities without choosing arbitrary P and T every time. Under the ideal-gas law, density at that fixed state collapses to a single function of molar mass: rho equals P STP times M over R times T STP. This capability applies classic chemistry STP—zero degrees Celsius and one atmosphere—with the CODATA gas constant, accepts molar mass in grams per mole, returns density in kilograms per cubic metre (numerically the same as grams per litre), and rejects zero or negative molar mass with a clear invalid input error.
STP definition, formula, and how to send molar mass
Classic chemistry standard temperature and pressure means absolute temperature two hundred seventy-three point one five kelvin (zero degrees Celsius) and pressure one hundred one thousand three hundred twenty-five pascals (one atmosphere). Starting from the ideal-gas law and rearranging for mass per volume produces density rho equal to pressure times molar mass over the gas constant times temperature. Internally the engine converts grams per mole to kilograms per mole so the SI evaluation yields density in kilograms per cubic metre—the same numeric value many textbooks report as grams per litre.
The gas constant is the CODATA value eight point three one four four six two six one eight joules per mole kelvin; molar volume at STP is also returned in cubic metres per mole and litres per mole for cross-checks against the familiar twenty-two point four litre classroom figure.
What you can do with it
Homework and exam verification
Students compute gas density at STP from molar mass alone, compare against textbook answers near 22.4 L/mol, and get a clear error when zero or negative M is submitted by mistake.
Lab notebooks and reference tables
Digital notebooks fill STP density columns for air, O2, N2, or CO2 from molar mass without embedding a full thermo package.
FAQ
How do I calculate gas density at STP with this tool?
The response density is ρ = P_STP·M/(R·T_STP) at 0 °C and 1 atm, in kg/m³.
What happens if molar mass is zero or negative?
Molar mass must be strictly positive; zero or negative values are rejected and not charged.
Which STP definition is used?
Classic chemistry STP: 0 °C (273.15 K) and 1 atm (101325 Pa), with the CODATA gas constant. This is not the post-1982 IUPAC 100 kPa standard.
Is the gas density at STP calculator free?
The browser tool runs free on your device.
How is this different from the ideal gas density calculator?
This product fixes P and T at STP and needs only molar mass. The ideal-gas density tool accepts arbitrary pressure, molar mass, and temperature for non-STP conditions.
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/gas-density-at-stp \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"molar_mass":28.97}'const res = await fetch("https://api.kit.forhosting.com/chem/gas-density-at-stp", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"molar_mass": 28.97
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/chem/gas-density-at-stp",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"molar_mass": 28.97
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/chem/gas-density-at-stp", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"molar_mass":28.97}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"molar_mass":28.97}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/chem/gas-density-at-stp", 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": 28.97
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "chem.gas_density_at_stp",
"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
STP definition, formula, and how to send molar mass
With P and T locked at STP, only molar mass remains free: send the required field molar_mass as a finite JSON number or numeric string in grams per mole. Aliases M, mm, molecular_weight, and MW are accepted when documented. Zero or negative molar mass is invalid_input because a non-positive M is non-physical for this product. Identical inputs always produce identical JSON because the path is pure arithmetic with no network, no random seed, and no wall clock.
Reading the density response and checking physical sense
Molar_volume_m3_per_mol and molar_volume_L_per_mol report the ideal-gas molar volume at the same STP, which should sit near twenty-two point four litres per mole. Dry air near twenty-nine grams per mole lands near one point three kilograms per cubic metre at this STP—if your result is orders of magnitude off, confirm that molar mass was entered in grams per mole rather than kilograms per mole. Magnitude caps reject absurd scientific-notation extremes while still covering every classroom and pilot-scale gas example. On success the response echoes molar_mass in grams per mole and molar_mass_kg_per_mol used in the SI formula, plus the fixed temperature_stp, pressure_stp, and r constants so auditors can see the exact STP definition applied. The scalar density field is the mass density at STP in kilograms per cubic metre; density_unit is always the string kg/m³ for UI captions. Formula is always the Unicode identity rho equals P STP times M over R times T STP, and method is always gas_density_at_stp so downstream code can branch without sniffing shapes. Missing molar_mass, non-finite values, and zero or negative molar mass all fail with invalid_input and are not charged.
API usage, pricing, classroom workflows, and practical limits
Call the free in-browser gas density at STP calculator for homework checks, lecture demos, and quick sanity tests on air, oxygen, nitrogen, or carbon dioxide without installing a process simulator. Send a JSON body with the single required field molar_mass (or an accepted alias). Use the prepaid API when a tutoring platform, digital lab notebook, SCADA helper, or curriculum generator 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 the free-condition ideal gas density tool when you already know non-STP pressure and temperature, or with a molar mass calculator when the next step is formula-to-grams-per-mole conversion. This product uses classic one-atmosphere STP, not the later IUPAC one-hundred-kilopascal definition—if your lab standard is one hundred kilopascals, use the free P, M, T calculator with those values instead. Authors shipping SDKs can map density straight into UI readouts while showing stp_definition as a caption so students see the same zero Celsius, one atmosphere reference they write by hand.
Integration use cases
Tutoring and curriculum generators
Lesson builders produce stable JSON for STP density drills, flashcards, and auto-graded gas-law problems at $0.002 per successful API item.