{
  "id": "ideal-gas-law",
  "version": "22338ce85320",
  "status": "published",
  "name": "Ideal Gas Law Calculator",
  "question": "What does the ideal gas law give?",
  "summary": "Solves the ideal gas law PV = nRT for pressure, volume, moles or temperature, from moles or from a mass and molar mass, in atm, kPa, torr, liters, °C and kelvins.",
  "category": "chemistry",
  "subcategory": "gases",
  "url": "https://www.acalculator.org/chemistry/ideal-gas-law-calculator",
  "markdown": "https://www.acalculator.org/chemistry/ideal-gas-law-calculator.md",
  "kind": "function",
  "method": "PV = nRT with R = 8.31446261815324 J/(mol·K) (0.0820574 L·atm/(mol·K)). P = nRT ÷ V; V = nRT ÷ P; n = PV ÷ RT; T = PV ÷ nR. From a mass: n = mass ÷ molar mass.",
  "assumptions": [
    "The gas behaves as an ideal gas: a fair model at ordinary pressures and temperatures, less so near condensation or at high pressure.",
    "Pressure is absolute pressure; temperature is absolute (K = °C + 273.15)."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "find": {
        "title": "Find",
        "description": "Which of pressure, volume, amount and temperature to work out from the other three.",
        "type": "string",
        "enum": [
          "P",
          "V",
          "T",
          "n"
        ]
      },
      "P": {
        "title": "Pressure (P)",
        "description": "The absolute pressure of the gas, not a gauge reading.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "pressure",
        "minimum": 1e-9,
        "maximum": 1000000000000
      },
      "V": {
        "title": "Volume (V)",
        "description": "The volume the gas fills.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "volume",
        "minimum": 1e-12,
        "maximum": 1000000000
      },
      "as": {
        "title": "Amount as",
        "description": "Type the amount of gas in moles, or as a mass and its molar mass.",
        "type": "string",
        "enum": [
          "mol",
          "mass"
        ]
      },
      "n": {
        "title": "Amount (n), mol",
        "description": "The amount of gas in moles.",
        "type": "number",
        "minimum": 1e-15,
        "maximum": 1000000000000000
      },
      "m": {
        "title": "Mass of gas",
        "description": "The mass of the gas.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "mass",
        "minimum": 1e-12,
        "maximum": 1000000000000
      },
      "M": {
        "title": "Molar mass, g/mol",
        "description": "The molar mass of the gas in grams per mole (16.04 for methane, 28.01 for nitrogen gas).",
        "type": "number",
        "minimum": 0.001,
        "maximum": 1000000
      },
      "T": {
        "title": "Temperature (T)",
        "description": "The gas temperature; above absolute zero.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "temperature",
        "minimum": 0.000001,
        "maximum": 1000000000
      }
    }
  },
  "outputs": {
    "result": {
      "label": "Answer",
      "description": "The value worked out, to 6 significant figures.",
      "format": "text"
    },
    "atm": {
      "label": "Pressure (atm)",
      "description": "The pressure in standard atmospheres.",
      "format": "number"
    },
    "kpa": {
      "label": "Pressure (kPa)",
      "description": "The pressure in kilopascals.",
      "format": "number"
    },
    "liters": {
      "label": "Volume (L)",
      "description": "The volume in liters.",
      "format": "number"
    },
    "moles": {
      "label": "Amount (mol)",
      "description": "The amount of gas in moles.",
      "format": "number"
    },
    "grams": {
      "label": "Mass (g)",
      "description": "The mass of gas in grams: moles × molar mass.",
      "format": "number"
    },
    "kelvin": {
      "label": "Temperature (K)",
      "description": "The absolute temperature in kelvins.",
      "format": "number"
    },
    "celsius": {
      "label": "Temperature (°C)",
      "description": "The temperature in degrees Celsius.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "find": "V",
      "P": "745 torr",
      "V": "22.4 L",
      "as": "mass",
      "n": 1,
      "m": "655 g",
      "M": 16.04,
      "T": "25 °C"
    },
    "outputs": {
      "result": "V = 1019.17 L",
      "atm": 0.9802631578947368,
      "kpa": 99.32516447368421,
      "liters": 1019.170024635189,
      "moles": 40.8354114713217,
      "grams": 655,
      "kelvin": 298.15,
      "celsius": 25
    },
    "text": "The answer is V = 1019.17 L."
  },
  "examples": [
    {
      "given": {
        "find": "V",
        "P": 99325.16447368421,
        "as": "mass",
        "m": 0.655,
        "M": 16.04,
        "T": 298.15
      },
      "expect": {
        "liters": 1019.170024635189,
        "result": "V = 1019.17 L"
      },
      "source": "OpenStax, Chemistry 2e, §9.2 Relating Pressure, Volume, Amount, and Temperature: The Ideal Gas Law (PV = nRT), https://openstax.org/books/chemistry-2e/pages/9-2-relating-pressure-volume-amount-and-temperature-the-ideal-gas-law, Example 9.9 Using the Ideal Gas Law: 1.02 × 10³ L; Python 3 with R = 8.31446261815324"
    },
    {
      "given": {
        "find": "P",
        "V": 0.01,
        "as": "mol",
        "n": 0.0025,
        "T": 308.15
      },
      "expect": {
        "atm": 0.006321494339461932
      },
      "source": "OpenStax, Chemistry 2e, §9.3 Stoichiometry of Gaseous Substances, Mixtures, and Reactions, https://openstax.org/books/chemistry-2e/pages/9-3-stoichiometry-of-gaseous-substances-mixtures-and-reactions, Example 9.14 The Pressure of a Mixture of Gases: P(H₂) = 6.32 × 10⁻³ atm; Python 3"
    },
    {
      "given": {
        "find": "n",
        "P": 101325,
        "V": 0.0224,
        "M": 28.01,
        "T": 273.15
      },
      "expect": {
        "n": 0.999376748282535
      },
      "source": "OpenStax, Chemistry 2e, §9.2 Relating Pressure, Volume, Amount, and Temperature: The Ideal Gas Law (PV = nRT), https://openstax.org/books/chemistry-2e/pages/9-2-relating-pressure-volume-amount-and-temperature-the-ideal-gas-law (standard molar volume about 22.4 L at STP); hand calculation in content.mdx: n = PV ÷ RT"
    },
    {
      "given": {
        "find": "T",
        "P": 101325,
        "V": 0.0224,
        "as": "mol",
        "n": 1
      },
      "expect": {
        "kelvin": 272.97975879337446
      },
      "source": "OpenStax, Chemistry 2e, §9.2 Relating Pressure, Volume, Amount, and Temperature: The Ideal Gas Law (PV = nRT), https://openstax.org/books/chemistry-2e/pages/9-2-relating-pressure-volume-amount-and-temperature-the-ideal-gas-law; hand calculation in content.mdx: T = PV ÷ nR = 101,325 × 0.0224 ÷ 8.31446261815324"
    }
  ],
  "sources": [
    "OpenStax, Chemistry 2e, section 9.2 Relating Pressure, Volume, Amount, and Temperature: The Ideal Gas Law: PV = nRT; R = 0.08206 L·atm/(mol·K) = 8.314 kPa·L/(mol·K); Example 9.9. CC BY 4.0, retrieved 2026-10-03. https://openstax.org/books/chemistry-2e/pages/9-2-relating-pressure-volume-amount-and-temperature-the-ideal-gas-law",
    "OpenStax, Chemistry 2e, section 9.3 Stoichiometry of Gaseous Substances, Mixtures, and Reactions: Example 9.14. CC BY 4.0, retrieved 2026-10-03. https://openstax.org/books/chemistry-2e/pages/9-3-stoichiometry-of-gaseous-substances-mixtures-and-reactions",
    "NIST, CODATA value of the molar gas constant R = 8.314462618... J/(mol·K), exact. Retrieved 2026-10-03. https://physics.nist.gov/cgi-bin/cuu/Value?r"
  ],
  "related": [
    "combined-gas-law",
    "mole",
    "molar-mass"
  ],
  "changelog": []
}
