ForHosting KIT · Science

Boyle's law calculator

A gas at pressure 2 and volume 3 compressed to pressure 6 ends at volume 1, because P1·V1 = P2·V2 keeps the product at 6. Use any pressure and volume units, as long as both states share them. 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
P2
6
You get
V2
1
Product
6
Solved for
v2

Boyle's law is the isothermal ideal-gas relationship that keeps the product of pressure and volume constant when temperature and amount of gas do not change. In symbols, P1 times V1 equals P2 times V2: if you compress a gas slowly enough that heat can leave and the temperature stays fixed, pressure rises as volume falls in inverse proportion. Zero volume is rejected because an empty container is outside the model.

How Boyle's law relates initial and final pressure and volume

Robert Boyle observed that for a fixed amount of gas held at constant temperature, pressure and volume trade off so that their product stays the same. The working equation is therefore P1 · V1 = P2 · V2, which rearranges to V2 = (P1 · V1) / P2 when the final pressure is known, or P2 = (P1 · V1) / V2 when the final volume is known.

Pressure may be expressed in atmospheres, kilopascals, bars, or torr as long as P1 and P2 share the same unit; volume may be litres, cubic metres, or millilitres as long as V1 and V2 share the same unit. The calculator does not convert between unit systems, does not introduce temperature through the ideal-gas law, does not apply Charles's or Gay-Lussac's relations, and does not correct for real-gas compressibility factors. It answers only the algebraic definition that secondary-school and first-year chemistry courses call Boyle's law.

Zero volume is the critical validation edge: an initial or final volume of zero is rejected with invalid input instead of producing division by zero or a meaningless infinite pressure. Zero pressure is likewise rejected when it would make the product undefined or divide by zero while solving for volume.

What you send and what you get back

Send finite numbers under the fields p1 and v1 for the initial state, plus exactly one of p2 or v2 for the known final state. p1 is the initial pressure in any consistent pressure unit and must be non-zero. v1 is the initial volume in any consistent volume unit and must be non-zero; zero volume fails with a message that names the zero-volume rule. If you supply p2, the engine solves for v2 equals the product P1 times V1 divided by P2.

If you supply v2, it solves for p2 equals that same product divided by V2. Missing fields, non-numeric strings, NaN, and Infinity also fail and are not charged. Classic textbook checks include doubling the pressure of a three-litre sample and recovering half the volume, or halving the volume of a pressurized cylinder and recovering double the pressure.

Where Boyle's law calculations show up in real work

Secondary-school chemistry and physics courses constantly assign problems that give two pressures and one volume—or two volumes and one pressure—and ask for the missing isothermal state variable, often for syringe demos, diving tanks, or weather-balloon sketches under the constant-temperature idealization. University general-chemistry labs use the same three-number reduction before they introduce absolute temperature scales and the full ideal-gas equation. Process technicians and HVAC trainees sanity-check closed-system compressions when only an isothermal bound is needed.

If you later need Charles's law with temperature, the combined gas law, mole-based ideal-gas calculations, unit conversion between atmospheres and pascals, or adiabatic polytropic work, treat those as separate search intents and landings rather than overloading this Boyle's law calculator page.

Homework and lab answer keys

Solve P1·V1=P2·V2 for the missing final P or V so teachers and auto-graders share one ground truth, including the zero-volume rejection.

Syringe and cylinder isothermal checks

Estimate final pressure after a measured volume change—or final volume after a target pressure—under a constant-temperature assumption.

What formula does this Boyle's law calculator use?

P1 · V1 = P2 · V2 at constant temperature.

What happens if volume is zero?

Zero volume (v1 or v2) is not allowed under Boyle's law in this calculator.

Do I need both final pressure and final volume?

No. Provide exactly one of p2 or v2. The calculator solves for the other. Sending both or neither is rejected.

What units should I use?

Any consistent pressure unit for p1 and p2, and any consistent volume unit for v1 and v2. The tool does not convert units; convert before calling if your sheet mixes systems.

What does it cost?

The browser tool is free and runs locally.

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/thermo/boyles-law

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/thermo/boyles-law \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"p1":2,"v1":3,"p2":6}'
{
  "p1": 2,
  "v1": 3,
  "p2": 6
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "thermo.boyles_law",
  "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.

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.

This calculator takes the initial pressure and volume plus exactly one final value—either the final pressure or the final volume—and returns the missing final quantity, the conserved product, and a clear solved_for flag.

What you send and what you get back

Supplying both final fields or neither fails with invalid_input so clients fix the request rather than guessing which field to trust. On success the response echoes cleaned p1, v1, p2, and v2, reports product as P1 times V1, sets solved_for to either p2 or v2, and includes the formula string and method boyles_law. Pricing for successful API calls is the published base of $0.002 per item; validation failures do not consume prepaid balance.

Where Boyle's law calculations show up in real work

Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.

Curriculum widgets and API fixtures

Drive browser demos and CI golden tests from the same isomorphic solver so classroom tools never disagree with backend grading.

Read the full KIT documentation →