ForHosting KIT · Science

Boyle's law calculator

Find the new pressure of a gas squeezed or expanded at constant temperature: 2 atm in 3 litres becomes 4 atm when the volume drops to 1.5 litres. Halve the volume and the pressure doubles. 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
P1
2
V1
3
V2
1.5
You get
P2
4
Ratio
2
Law
boyle
Conditions
constant temperature and amount of substance

A Boyle's law final-pressure calculator turns initial pressure and volume plus a new volume into the pressure you expect when temperature and amount of gas stay fixed. Ideal-gas classroom problems, syringe and piston estimates when only volume changes, and coding kata expected values all need that same inverse P-V rule without opening a full equation-of-state solver.

What Boyle's law says about pressure and volume

Boyle's law states that for a fixed amount of ideal gas at constant temperature, pressure and volume are inversely proportional: the product P times V is constant. In symbols, P1 times V1 equals P2 times V2, so the final pressure is P2 equals P1 multiplied by the ratio V1 over V2. If you compress a gas to half its original volume while holding temperature fixed, the pressure doubles; if you expand the volume to three times the initial size, the pressure falls to one third.

The law is the P-V branch of the ideal-gas family that also includes Charles (V-T at fixed n,P), Gay-Lussac (P-T at fixed n,V), and Avogadro (V-n at fixed T,P). Teachers and automated graders care about the zero-V2 rejection as much as the happy path: a student who sets final volume to zero has left the domain of the ratio, and inventing an infinite pressure would hide that mistake.

The check path recomputes the ratio and product with the same fixed twelve-decimal rounding used for published fields, so a successful response always ships with steps you can assert in tests or worksheets. Pressure and volume units are caller-chosen and consistent—atmospheres, pascals, bars, or torr for pressure and litres, cubic metres, or millilitres for volume all work as long as P1 and P2 share one pressure unit and V1 and V2 share one volume unit.

Practical tips, limits, and related searches

Keep inputs inside the published absolute range so the product P1 times V1 over V2 cannot overflow into a non-finite final pressure 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. Near-zero final volume after floating cancellation is classified as zero and rejected so noise does not invent a huge pressure.

Prefer this capability when temperature and moles truly stay fixed and only volume changes; if T or n also moves, use an ideal or combined gas-law tool instead. Round-trip checks are easy: recompute P1 times V1 divided by V2 by hand and confirm it equals the published p2 within the same twelve-decimal rounding, and confirm that halving V2 at fixed V1 doubles p2.

Homework checks for P ∝ 1/V problems

Students enter textbook P1, V1, and V2 and compare hand-written final pressure and volume ratio against a deterministic result before submitting.

Syringe and piston estimates at fixed T

Lab notes estimate pressure when a sealed gas sample is compressed or expanded without changing bath temperature or amount of gas.

What is Boyle's law?

At constant temperature and amount of gas, pressure and volume are inversely proportional: P1·V1 = P2·V2, so P2 = P1·(V1/V2).

Do I need temperature or moles as inputs?

No. Boyle's law assumes T and n are constant; only P1, V1, and V2 are required.

Is this the same as the ideal gas law?

No. The ideal gas law solves PV = nRT for any variable. This calculator applies only Boyle's inverse P-V relation at fixed T and n.

Is the Boyle's law calculator free?

The browser tool is free and runs locally.

What happens to the pressure if I triple the volume?

It falls to one third of the starting value. Pressure and volume are inversely proportional at constant temperature, so the tool multiplies the initial pressure by the old volume divided by the new one.

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/boyle-final-pressure

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/boyle-final-pressure \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"p1":2,"v1":3,"v2":1.5}'
{
  "p1": 2,
  "v1": 3,
  "v2": 1.5
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "chem.boyle_final_pressure",
  "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.

Enter P1, V1, and V2; the tool returns P2 equals P1 times V1 over V2, the volume ratio, a clear formula string, and step-by-step substitution so homework checks, lab write-ups, and pipeline tests all see the same deterministic JSON. When final volume is zero the ratio is undefined, so the API returns invalid_input instead of infinity or a silent nonsense pressure.

How to call the API and what comes back

Initial pressure p1 and initial volume v1 must be strictly positive; final volume v2 must be strictly positive and non-zero—values whose absolute value is at or below one times ten to the minus fifteen are treated as zero and rejected. Send a JSON body with three required finite numbers: p1 (aliases P1, pressure1, initial_pressure, p_initial), v1 (aliases V1, volume1, initial_volume, v_initial), and v2 (aliases V2, volume2, final_volume, v_final). 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 p1, v1, and v2, sets p2 to the computed final pressure, ratio to V1 over V2, formula to the string P2 equals P1 times V1 over V2, law to boyle, conditions to constant temperature and amount of substance, unit_pressure and unit_volume to short unit hints, message to a short English summary, and steps to an ordered array of substitution lines. Failed validation—missing fields, non-finite numbers, values outside absolute limits, non-positive pressure or initial volume, zero or negative final volume—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 searches

When teaching, pair examples: P1 equals two atmospheres with V1 equals three litres and V2 equals one and a half litres yields P2 equals four atmospheres; equal volumes leave pressure unchanged; and V2 equals zero demonstrates the hard invalid_input path that protects division by zero. This landing targets people searching for a Boyle's law calculator, final pressure from volume change, or P1V1 equals P2V2 online; it is not a full ideal-gas PV equals nRT solver, not a Charles or Gay-Lussac temperature tool, and not a unit converter for pressure. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when learners deliberately set V2 to zero.

Unit tests for gas-law helpers

Generate known-good P2 cases plus deliberate V2-equals-zero rejections for coding kata expected values and CI fixtures.

What happens when final volume V2 is zero?

The ratio is undefined. This tool returns invalid_input instead of computing an infinite or nonsensical pressure.

Read the full KIT documentation →