Gas Law Calculator

Change the pressure, volume or temperature of a gas and see what the others become — the standard laws relating the three, in one place. Temperatures are converted to kelvin before any sum is done, because in degrees Celsius every one of these laws gives nonsense.

How to use it

Leave one box empty and that is the one filled in for you, whether it is pressure, volume, amount or temperature, either for a single state or for a before-and-after change.

  1. Choose the law that matches your question One state with four quantities is the ideal gas law. A change from one state to another is the combined law, or one of the three named laws when something is being held still.
  2. Fill in everything except the one you want Leave exactly one box empty and it is worked out. Fill them all in and you are told instead whether the numbers actually agree with each other.
  3. Set the units to whatever you have Pressure, volume and temperature each have their own setting, and the answer comes back in the same units you chose.
Full instructions
In depth

How to use the gas law calculator for pressure, volume and temperature

This article walks through the ideal gas law and its three simpler cousins, explains why temperature must be in kelvin before anything works, and shows how to set up each kind of problem in the calculator so the answer comes out right the first time.

Screenshot: Twenty degrees to forty is not twice as hot
Twenty degrees to forty is not twice as hot as it appears when the page opens.

One equation for four quantities

PV = nRT ties four things together: pressure, volume, the amount of gas in moles, and temperature. If you know three of them, the fourth drops straight out of the algebra. That is the ideal gas law, and it covers most of the questions a chemistry or physics class will throw at you.

The calculator puts this into practice in a direct way. Pick the ideal gas law from the Which law selector, fill in three of the four boxes, and leave the fourth empty. The empty one is the unknown, and the page solves for it as soon as you stop typing. If you happen to fill in all four, the tool checks whether your numbers actually agree with the equation and tells you by how much they drift.

Why everything has to be kelvin

This is the single biggest source of wrong answers in gas calculations, and it trips people up over and over. A gas at twenty degrees Celsius that warms to forty degrees Celsius has not doubled in temperature. In kelvin those numbers are 293 and 313, which is a rise of about seven per cent. The equation cares about how much energy the molecules carry, and that count starts at absolute zero, not at the freezing point of water.

The calculator handles this for you. Choose your preferred unit from the Temperature in selector, which offers degrees Celsius, kelvin and degrees Fahrenheit. Whatever you pick, the page converts to kelvin behind the scenes before it does any arithmetic, and then converts the answer back into whichever unit you chose. You never need to do the conversion by hand, but knowing it happens explains why the same pair of Celsius readings gives a different ratio than you might expect.

Setting the units for pressure and volume

Pressure and volume each have their own unit selector. Pressure offers kilopascals, pascals, bar, atmospheres, millimetres of mercury and psi. Volume offers litres, millilitres, cubic metres, cubic feet and US gallons. The answer always comes back in the same units you picked, so if you enter pressure in atmospheres you get pressure in atmospheres.

Internally the page converts everything to pascals and cubic metres before multiplying, then converts back. That means you can mix everyday units freely and never worry about matching them yourself. Just make sure the selector matches what is printed on your problem sheet, and the rest takes care of itself.

Before and after: the combined and named laws

Not every question is about a single snapshot of a gas. Many are about a change: a syringe is squeezed, a balloon goes outside into the cold, a tyre sits in the sun. For those, switch the Which law selector away from the ideal gas law.

The combined law covers the general case where pressure, volume and temperature can all change between the two states. Enter the before and after values, leave one box empty, and the missing quantity appears. Below the combined law sit the three named laws: Boyle's law holds temperature still, Charles's law holds pressure still, and Gay-Lussac's law holds volume still. When you pick one of these, the boxes for the held quantity vanish because they are not needed.

Think of the three named laws as shortcuts. They are all special cases of the combined law with one variable locked in place. Boyle's says that if you squeeze a gas without changing its temperature, the pressure rises in proportion. Charles's says that warming a gas at constant pressure makes it expand. Gay-Lussac's says that warming a gas in a rigid container makes the pressure climb. The combined law is just all three happening at once.

Molar mass and what it unlocks

Below the unit selectors is an optional field labelled Molar mass, measured in grams per mole. Most of the time you can ignore it, but if you fill it in the calculator reports two extra figures: the mass of the gas in grams and its density.

This is useful when a question gives you a mass instead of moles. Divide the mass by the molar mass yourself, type the answer into the Amount of gas box, and the law works as usual. There is no box for a mass: the molar mass field runs the other way, taking the moles the tool already has and reporting the mass and density that go with them. The molar mass field exists so that people working with real gases, say oxygen at 32 or nitrogen at 28, can see a mass and a density alongside the basic four-way result.

Sample problems you can try right away

The tool comes with four ready-made scenarios under the Try one heading. Each one loads a set of values and picks the right law, so you can see a solved problem before you start entering your own.

The first example, labelled One mole at room temperature, sets up the ideal gas law with one mole at standard pressure filling 24.4 litres, and leaves the temperature box empty so you can see which room temperature that volume implies. The second, Squeeze a syringe, demonstrates Boyle's law by doubling the pressure on a small volume and asking for the new volume. The third, Balloon into the cold, uses Charles's law to show what happens when a two-litre balloon goes from a warm room to freezing air. The fourth, Tyre on a hot day, applies Gay-Lussac's law to a sealed tyre whose temperature rises. Clicking any of these fills in the fields and runs the calculation instantly.

Gauge pressure and why it fools people

Tyre gauges and many industrial pressure readings start from zero at atmospheric pressure, not from zero at a vacuum. A tyre gauge that reads 220 kilopascals actually means the gas inside is at about 321 kilopascals absolute, because the atmosphere is pushing on the outside of the tyre as well.

Gas laws require the absolute figure. If you plug a gauge reading straight into the calculator, the answer will be noticeably wrong. Before entering a number from a garage forecourt or a pressure gauge on a tank, add roughly 101 kilopascals, 14.7 psi, or one atmosphere to it. This is the most common real-world mistake people make with these equations, and it only shows up when you try to match the answer against what actually happens.

Where the ideal gas law starts to drift

The word ideal in the name is doing real work. The equation assumes that gas molecules take up no space themselves and never pull on each other. At everyday pressures and warm temperatures, that is close enough for almost any classroom or workshop question.

The model starts to slip in two places. First, near the boiling point of the gas, where the molecules are close to turning into a liquid and attractions between them matter. Second, at pressures above roughly ten atmospheres, where the molecules are packed tightly enough that their own volume is no longer trivial. For those situations you need equations like van der Waals, which add correction terms. But for air in a room, gas in a lab, or a tyre on a car, the ideal law is well within practical accuracy.

The gas constant and the precision of your answer

R, the gas constant, is 8.31446261815324 joules per mole per kelvin. Since 2019 that number is defined exactly rather than measured, which means it introduces no error at all. The precision of the answer you get out depends entirely on the precision of the numbers you put in.

If your pressure is accurate to three figures and your volume to two, the answer is meaningful to two figures at best. The calculator does not round for you, so the display may show many digits. Read as many as your least accurate input justifies, and treat the rest as decoration.

Nothing leaves your browser

Every conversion, every solve, every sample scenario runs right on your own device. The page does not send your numbers to a server, and there is no login or account involved. That makes it fast even on a slow connection, and it means there is nothing for anyone else to store or see. Close the tab and the data is gone.

Help

Twenty degrees to forty is not twice as hot

Leave one box empty and that is the one filled in for you, whether it is pressure, volume, amount or temperature, either for a single state or for a before-and-after change. Whatever units you type, the working is done in pascals, cubic metres, moles and kelvin and converted back, so litres and atmospheres can share a problem.

Choose the law that matches your question

One state with four quantities is the ideal gas law. A change from one state to another is the combined law, or one of the three named laws when something is being held still.

Fill in everything except the one you want

Leave exactly one box empty and it is worked out. Fill them all in and you are told instead whether the numbers actually agree with each other.

Set the units to whatever you have

Pressure, volume and temperature each have their own setting, and the answer comes back in the same units you chose.

Gauge pressure is not the pressure in the equation

The gauge at a garage reads zero in open air, so a tyre at 220 kPa on the gauge is really at about 321 kPa, because the atmosphere is pressing too. Gas laws want that absolute figure. Use a gauge reading straight from the forecourt and a tyre-pressure calculation comes out noticeably wrong — add roughly 101 kPa, 14.7 psi or one atmosphere first.

Good to know

Temperature has to be absolute

Going from 20 to 40 degrees Celsius is 293 to 313 kelvin — under seven per cent, not double. Every gas law is written in kelvin, and putting degrees straight into one is the single commonest mistake in the topic.

The gas constant is exact

R is 8.31446261815324 joules per mole per kelvin, and since 2019 that is a defined number rather than a measured one. So the precision of your answer is set entirely by your own figures.

One mole is not always 22.4 litres

That figure is for freezing point and one atmosphere. At freezing point and one bar it is 22.7 litres, and in a warm room it is nearer 24. The volume one mole takes under your own conditions is worked out for you.

Real gases drift from this

The ideal gas law is very close at everyday pressures and warm temperatures. It starts to slip near the point where a gas would turn liquid, and above roughly ten atmospheres, where the molecules are close enough to pull on each other.

Common questions

How do I work out the volume of a gas?
Choose the ideal gas law, fill in the pressure, the amount in moles and the temperature, and leave the volume box empty.
Why must I use kelvin?
Because the equation is about how much energy the molecules have, and that is zero at absolute zero, not at the freezing point of water. Celsius has its zero in the wrong place, so ratios taken in it are meaningless.
What is the difference between Boyle's law and Charles's law?
Boyle's holds the temperature still: squeeze a gas and the pressure rises. Charles's holds the pressure still: warm a gas and it expands. Both are the combined law with one thing not changing.
How many litres does one mole of gas fill?
It depends entirely on the pressure and temperature. At freezing point and one atmosphere, 22.41 litres; at freezing point and one bar, 22.71; in a room at 20 degrees, about 24. Your own conditions are worked out for you.
Can I use degrees Fahrenheit?
Yes. Choose it and it is converted to kelvin before anything else happens, and answers come back in Fahrenheit as well.