Skip to content

Gas or vapour amount fraction in air to mass concentration, and back

calc_gas_concentration

Converts a gas or vapour's amount fraction in air to its mass concentration, or the reverse.

Runs
On the server
Level
Checked against a reference: exact rational arithmetic, against a second implementation in Python by a separate agent of the same model family; HSE EH40/2005 Table 1 at its printed digits
Ask your assistant

What it is

Returns a gas or vapour's mass concentration in air from its amount fraction, or the reverse. The temperature and absolute pressure are stated, never assumed. Use when converting a sensor's µmol/mol reading of CO2, ammonia or a solvent vapour to mg/m³. The amount fraction is by amount: a bare ppm is not accepted. Tables such as NIOSH's use the conventional 24.45 L/mol at 25 °C; this tool uses RT/p exactly. No comparison with an exposure limit is made. Not for pV = nRT: use `calc_gas_law`.

Field: Solutions and bench arithmetic.

What it does

You give

  • substance (required): The gas or vapour: a formula or a molar mass.
  • phase (required): gas or vapour; an aerosol or particulate (particulate) is refused, since it has a mass concentration only.
  • temperature (required): Temperature of the air. Must be above 0 K.
  • absolutePressure (required): Absolute pressure of the air. Must be above 0 Pa.
  • amountFraction: Amount fraction in air, by amount. Must be at least 0 µmol/mol and at most 1000000 µmol/mol. Optional.
  • massConcentration: Mass concentration in air. Must be at least 0 mg/m^3. Optional.

No request is recorded for this tool.

Limits

  • Bench arithmetic on solutions you describe.
  • Research and education software: it does not look up densities, check that a label is right, or assess hazards.
  • Conversion between a gas or vapour's amount fraction in air and its mass concentration, at the temperature and absolute pressure you state, for an ideal, dry gas.
  • The amount fraction is by amount, in µmol/mol or nmol/mol: a bare ppm or ppb, or ppm by mass, is not accepted.
  • Particulates and aerosols are refused.
  • It does not check whether a vapour would condense, and makes no comparison with any exposure limit.
  • Every computed number a reply returns, other than an integer or an exact decimal, is rounded once to 12 significant figures: to the nearest, a change of at most 5 × 10⁻¹² of its value, except that a lower bound is rounded down and an upper bound up, a change of less than 1 × 10⁻¹¹; the method computes, and decides any pass or fail, on the unrounded value.

It will not answer when

  • the mass concentration given implies more than one mole of the substance per mole of air at this temperature and pressure.
  • not exactly one of the amount fraction and the mass concentration is given.
  • the substance is declared an aerosol or particulate, which has a mass concentration only.
  • the substance gives both, or neither, of a formula and a molar mass.
Every input, with its units6 inputs
  • substance (required): The gas or vapour: a formula or a molar mass.
  • phase (required): gas or vapour; an aerosol or particulate (particulate) is refused, since it has a mass concentration only.
  • temperature (required): Temperature of the air. Must be above 0 K.
  • absolutePressure (required): Absolute pressure of the air. Must be above 0 Pa.
  • amountFraction: Amount fraction in air, by amount. Must be at least 0 µmol/mol and at most 1000000 µmol/mol. Optional.
  • massConcentration: Mass concentration in air. Must be at least 0 mg/m^3. Optional.
Every refusal, with its code4 refusals
CodeWhen
AMOUNT_FRACTION_ABOVE_ONEthe mass concentration given implies more than one mole of the substance per mole of air at this temperature and pressure.
FORM_COUNTnot exactly one of the amount fraction and the mass concentration is given.
PARTICULATEthe substance is declared an aerosol or particulate, which has a mass concentration only.
MOLAR_MASS_SOURCEthe substance gives both, or neither, of a formula and a molar mass.

The calculation

The method's equations, constants and worked example.

A gas or vapour's amount fraction in air to its mass concentration and back, at a stated temperature and pressurecalc-gas-concentration@1.1.2
ρ=x·M/Vm=x·M·p/(R·T)
x=ρ·Vm/M
SymbolMeaning
ρmass concentration of the substance in air, mg/m^3
xamount fraction of the substance (by amount, never by mass), µmol/mol
Mmolar mass of the substance, g/mol
V_mmolar volume of an ideal gas at the stated temperature and pressure, L/mol
pabsolute pressure (with R in J/(mol·K), R·T/p comes out in L/mol), kPa
Ttemperature, t in °C + 273.15, K
Rmolar gas constant N_A·k, exact (calc-gas-law), J/(mol·K)

Source 1.

ConstantValueFrom
standard atomic weights (CIAAW abridged), through formula-mass 1.1.0 A_ra table of values, part of the methodSource 2

A definition, not a model: the equation states what the quantity means. A different convention gives a different number.

Worked example

Worked example: one case of calc-gas-concentration@1.1.2, from its inputs through each step to the answer. Values are written as a person writes them; the working carries more digits, so your own figure may differ in the last digit shown.

Inputs

  • substance.formula = CO2
  • phase = gas
  • amountFraction = 1000 µmol/mol
  • temperature = 20 degC
  • absolutePressure = 101.325 kPa

Steps

  1. Vm = 24.055117 L/mol, from temperature, absolutePressure; by the equation above; gives molarVolume.
  2. rho = 1829.5068 mg/m³, from amountFraction, substance.formula, Vm; by the equation above; gives massConcentration.

The working, as the case writes it:

M(CO2) = 12.011 + 2 x 15.999 = 44.009 g/mol

Vm = 8.31446261815324 x 293.15 / 101325 = 0.0240549 m3/mol

rho = 1000e-6 x 44.009 / 0.0240549 = 1.8295068 g/m3 = 1829.5068 mg/m3 (worked by hand by the raising builder, 14 November 2026)

Answer

molarVolume = 24.055117 L/mol

massConcentration = 1829.5068 mg/m³

Where these values came from: our own exact-arithmetic script and a hand-worked case; the second implementation's run(arguments).

At build the tool returned this answer within the tolerance the file states: every number relative 1e-12 (absolute 1e-15 below 1e-3, in each value's unit); strings, notes, statuses and codes exact; where one path carries more than one unit, or a logarithmic unit, absolute at the relative value times the smallest nonzero magnitude under it (the largest, for a logarithm).

Sources

  1. Cohen ER et al. Quantities, Units and Symbols in Physical Chemistry (the IUPAC Green Book), IUPAC and RSC

    Used for: A gas or vapour's amount fraction in air to its mass concentration and back, at a stated temperature and pressure. At: section §2.10, printed p. 48: x_B = n_B/Σn_i, with the ideal-gas molar volume of calc-gas-law; µmol/mol × g/mol ÷ L/mol comes out exactly in mg/m³.

    Read in full, 11 November 2026
  2. IUPAC Commission on Isotopic Abundances and Atomic Weights (CIAAW), Abridged Standard Atomic Weights

    Used for: A gas or vapour's amount fraction in air to its mass concentration and back, at a stated temperature and pressure. At: table Abridged Standard Atomic Weights.

    Read in full, 10 November 2026

How it is checked

Level

Checked against a reference.

Checked against

Our own exact-arithmetic script and a hand-worked case; the source's own worked example, HSE EH40/2005 Workplace exposure limits, Table 1, 4th edition 2020, web version of the printed edition, read 24 November 2026 (SHA-256 736c6fc0…).

Cases

No case set is linked to this version.

Not checked

Exposure limits (no comparison is made); EH40/2005 Table 1's carbon monoxide short-term row, whose printed 117 mg.m-3 departs from EH40's own paragraphs 68 and 69 (116), and its molar volume 24.05526 L/mol, which implies R = 8.31451 (an older value; 6e-6 relative from RT/p today); condensation of a vapour; particulates; ppm by mass; humid air; real-gas behaviour. A formula starting with a digit (13NH3) is refused FORMULA_INVALID since 1.1.2, through formula-mass 1.3.0, with no case in this method's fixtures; the refusal is covered by stored reference values and unit tests only.

Changes to its methods1 change