ForHosting KIT · Science

Ideal gas law chemistry calculator

Enter any three of pressure, volume, moles and temperature and get the fourth from PV = nRT: 101325 Pa, 0.0224 m³ and 1 mol give 272.979758798406 K with the SI gas constant. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Power (W)
101,325
Voltage (V)
0.0224
N
1
You get
Pressure
101,325
Volume
0.0224
Moles
1
T
272.9797587984

An ideal gas law chemistry calculator rearranges PV equals nRT so you can solve for whichever state variable you do not already know in a chemistry problem. Pressure, volume, moles, and the gas constant must also be positive so the rearrange never divides by zero or invents a non-physical magnitude. The default gas constant is the SI value 8.314462618 joules per mole per kelvin, matching pascals and cubic metres; pass a chemistry-friendly R such as 0.082057 litre atmospheres per mole per kelvin when your problem uses atmospheres and litres.

What the ideal gas law means in chemistry

The ideal gas law is the central state equation of introductory general chemistry: the product of pressure and volume equals the product of the amount of substance in moles, the universal gas constant, and absolute temperature, written compactly as P times V equals n times R times T.

Real laboratory gases approach this model when pressure is moderate and temperature is well above the boiling range of the substance, so stoichiometry problems, molar-volume estimates at STP, and many exam items start here before students meet van der Waals or other real-gas corrections.

Units of pressure, volume, and R must match each other: with the default R of 8.314462618 joules per mole per kelvin, pressure is in pascals and volume in cubic metres; if your chemistry worksheet prefers atmospheres and litres, supply R approximately 0.082057 litre atmospheres per mole per kelvin instead of relying on the SI default. Exactly three of the four state variables must be known so the fourth is uniquely determined; providing all four or fewer than three is a validation error rather than a silent average or consistency residual.

The check path recomputes the rearranged expression with the same fixed rounding used for published fields, so a successful response always ships with steps you can assert in tests, lab reports, or chemistry worksheets.

Practical tips, limits, and related chemistry searches

Convert Celsius to kelvin before calling the tool, and never pass a temperature of zero or below on the absolute scale. Keep inputs inside the published absolute range so products such as n R T cannot overflow into a non-finite result that the solver must reject. Prefer sending numbers rather than pre-formatted strings when you control the client; string numbers are accepted only when they match a strict finite numeric pattern.

Prefer this capability when you already have three consistent chemistry state quantities and only need the fourth under the ideal-gas assumption; if your gas is dense or near condensation, use a real-gas model instead.

Chemistry homework checks for PV = nRT

Students enter three known state variables from textbook ideal-gas chemistry problems and compare hand-written P, V, n, or T against a deterministic result before submitting.

Lab prep and molar-volume estimates

Quickly estimate the missing pressure, volume, moles, or temperature for a gas sample when the ideal-gas approximation is acceptable for bench work.

What is the ideal gas law?

The ideal gas law is PV = nRT: pressure times volume equals moles times the gas constant times absolute temperature in kelvin. Given any three of P, V, n, and T with a consistent R, you can solve for the fourth.

What gas constant R should I use?

Default R is 8.314462618 J/(mol·K) for SI (Pa and m³). For litre–atmosphere chemistry problems, pass about 0.082057 L·atm/(mol·K) as r so P and V units match.

Is the ideal gas law chemistry calculator free?

The browser tool is free and runs locally.

Why must the temperature be in kelvin?

Because the ideal gas law works with absolute temperature, and zero or a negative value on the kelvin scale has no meaning in it. Convert Celsius to kelvin before entering it; zero kelvin or below is rejected.

How many of P, V, n and T do I need to enter?

Exactly three, so the missing one is uniquely determined. Entering all four, or fewer than three, is refused instead of averaging or guessing, so leave the value you want to find empty.

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.

POSThttps://api.kit.forhosting.com/chem/ideal-gas

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.

curl -X POST https://api.kit.forhosting.com/chem/ideal-gas \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"p":101325,"pressure":-1000000000000}'
{
  "p": 101325,
  "pressure": -1000000000000
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "chem.ideal_gas",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_abs1000000000000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Temperature must be strictly positive on the kelvin scale—zero or negative kelvin is rejected with a clear invalid_input error because absolute temperature cannot be non-positive in this model.

What the ideal gas law means in chemistry

Absolute temperature must be in kelvin (or another absolute scale consistent with the R you choose); converting from Celsius means adding two hundred seventy-three point one five before you call the API, because a non-positive kelvin value has no meaning for this equation and is rejected outright. Teachers and automated graders care about the non-positive temperature rejection as much as the success path: a learner who forgets the Celsius-to-kelvin shift should see an explicit invalid_input message instead of a nonsense negative absolute temperature.

How to call the API and what comes back

Every provided state variable and the gas constant must be strictly positive; temperature in particular must be positive kelvin whether it is an input or the solved unknown. Send a JSON body with exactly three of the four state fields filled: p (aliases pressure and P), v (aliases volume and V), n (aliases moles, amount, and mol), and t (aliases temperature, T, temp, and kelvin). Optionally include r (aliases R, gas_constant, and gasConstant); when omitted the solver uses 8.314462618. Absolute values must stay within the published limit of one trillion so intermediate products remain finite in IEEE double precision on the Worker and in the browser. On success the response echoes rounded p, v, n, t, and r, mirrors them as pressure, volume, moles, temperature, temperature_kelvin, and gas_constant, sets solved_for and unknown to the single letter of the omitted variable, formula and rearrange to the algebraic form used, equation to a filled PV equals nRT string, product_pv and product_nrt to the two sides after rounding, message to a short English summary, and steps to an ordered array of substitution lines. Failed validation—wrong count of state variables, missing numbers, non-finite values, values outside absolute limits, non-positive P V n R, or non-positive temperature in kelvin—returns invalid_input and is never charged. Pricing is a flat $0.002 per successful request with unit item and zero marginal unit price.

Practical tips, limits, and related chemistry searches

When teaching chemistry, pair examples: omit temperature with roughly one atmosphere in pascals, about twenty-two point four litres worth of cubic metres, and one mole to recover near two hundred seventy-three kelvin; omit pressure with the same volume, one mole, and two hundred seventy-three point fifteen kelvin to recover near standard pressure; omit volume or moles to practice the other two rearrangements with consistent R; and deliberately send t equals zero to demonstrate the hard invalid_input path that guards against forgotten unit conversions. This landing targets people searching for an ideal gas law chemistry calculator, PV equals nRT solver for classwork, or pressure-volume-moles-temperature homework help online; it is not a real-gas equation-of-state tool, not a multi-component mixture calculator, and not a standalone unit converter. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when learners deliberately send bad temperatures. Round-trip checks are easy: recompute the rearranged expression by hand and confirm it equals the published unknown within the same twelve-decimal rounding, and confirm that product_pv and product_nrt agree for a fully consistent rounded state after you solve for any one of P, V, n, or T.

Unit tests for student gas solvers

Generate known-good rearrangements for each unknown plus deliberate non-positive kelvin rejections for coding kata expected values in chemistry tools.

Why must temperature be in kelvin?

The ideal gas law uses absolute temperature. Zero or negative kelvin is not physically valid for this model; this tool returns invalid_input for non-positive temperature.

How many of P, V, n, and T do I need?

Provide exactly three and omit the unknown. Fewer or more than three state variables returns invalid_input.

Read the full KIT documentation →