curatedapi

Volume converter

Convert between metric, US customary, imperial and cubic units of volume.

The amount to convert.
Unit of the value. Options: m3: cubic metre; l: litre; ml: millilitre; cm3: cubic centimetre; in3: cubic inch; ft3: cubic foot; yd3: cubic yard; gal_us: US gallon; qt_us: US liquid quart; pt_us: US liquid pint; cup_us: US customary cup; cup_us_legal: US legal cup (nutrition labels); floz_us: US fluid ounce; tbsp_us: US tablespoon; tsp_us: US teaspoon; bbl_oil: oil barrel; gal_imp: imperial gallon; qt_imp: imperial quart; pt_imp: imperial pint; floz_imp: imperial fluid ounce
Unit to convert to. Omit to convert to every unit. Options: m3: cubic metre; l: litre; ml: millilitre; cm3: cubic centimetre; in3: cubic inch; ft3: cubic foot; yd3: cubic yard; gal_us: US gallon; qt_us: US liquid quart; pt_us: US liquid pint; cup_us: US customary cup; cup_us_legal: US legal cup (nutrition labels); floz_us: US fluid ounce; tbsp_us: US tablespoon; tsp_us: US teaspoon; bbl_oil: oil barrel; gal_imp: imperial gallon; qt_imp: imperial quart; pt_imp: imperial pint; floz_imp: imperial fluid ounce
More options: rounding and decimals
Precision and rounding
Rounding mode applied once to each result. Default half_even.
Round results to this many digits after the decimal point.
Round results to this many significant digits.

Examples

Example: One US gallon in litres

Result
The converted value.
3.785411784 exact
Factor
How many to_unit make one from_unit (multiply by this to convert).
3.785411784 exact

Rounding: Half even, 15 significant digits. Calculator units/volume@1.

How it is calculated

result = value × factor(from_unit) ÷ factor(to_unit), factors in m³

Convert between metric, US customary, imperial and cubic units of volume. Conversion factors are exact values from the official unit definitions, so the result is exact before the single final rounding. Leave out to_unit to get the value in every supported unit.

  • US and imperial gallons, pints and fluid ounces are different units; the codes say which is meant.
  • Unit definitions: 1 m3 = 1 m³ (SI derived unit); 1 l = 0.001 m³ (1 dm³ (CGPM 1964)); 1 ml = 0.000001 m³ (SI prefix); 1 cm3 = 0.000001 m³ (SI derived unit); 1 in3 = 0.000016387064 m³ ((0.0254 m)³); 1 ft3 = 0.028316846592 m³ ((0.3048 m)³); 1 yd3 = 0.764554857984 m³ ((0.9144 m)³); 1 gal_us = 0.003785411784 m³ (231 in³); 1 qt_us = 0.000946352946 m³ (1/4 US gallon); 1 pt_us = 0.000473176473 m³ (1/8 US gallon); 1 cup_us = 0.0002365882365 m³ (1/16 US gallon); 1 cup_us_legal = 0.00024 m³ (240 mL (21 CFR 101.9)); 1 floz_us = 0.0000295735295625 m³ (1/128 US gallon); 1 tbsp_us = 0.00001478676478125 m³ (1/2 US fluid ounce); 1 tsp_us = 0.00000492892159375 m³ (1/6 US fluid ounce); 1 bbl_oil = 0.158987294928 m³ (42 US gallons); 1 gal_imp = 0.00454609 m³ (4.54609 L (UK Weights and Measures Act 1985)); 1 qt_imp = 0.0011365225 m³ (1/4 imperial gallon); 1 pt_imp = 0.00056826125 m³ (1/8 imperial gallon); 1 floz_imp = 0.0000284130625 m³ (1/160 imperial gallon)

References

Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.

Use it from your code

POST /v1/calc/units/volumeVersion 1
curl https://api.curatedapi.com/v1/calc/units/volume \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "1",
    "from_unit": "gal_us",
    "to_unit": "l"
  }'
The same call in Python
import os

import requests

payload = {
    "value": "1",
    "from_unit": "gal_us",
    "to_unit": "l",
}
response = requests.post(
    "https://api.curatedapi.com/v1/calc/units/volume",
    headers={"Authorization": f"Bearer {os.environ['CURATEDAPI_KEY']}"},
    json=payload,
    timeout=10,
)
print(response.json()["result"])
The same call in JavaScript
const payload = {
    "value": "1",
    "from_unit": "gal_us",
    "to_unit": "l",
};
const response = await fetch("https://api.curatedapi.com/v1/calc/units/volume", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.CURATEDAPI_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(payload),
});
console.log((await response.json()).result);

MCP tool calc_units_volume at https://mcp.curatedapi.com. Inputs, outputs and errors in the API reference.

Put it on your website

<div data-curatedapi-widget="units/volume" data-key="capi_public_…"></div>
<script src="https://widgets.curatedapi.com/v1/widget.js" async></script>

Use a public key registered for your site. Calculations are billed like API calls. How widgets work.

Related calculators

Add this calculator to your website

Paste two lines into your page and your visitors get this calculator. Each use counts as one call on your plan, the same as the API.

Free for up to 1,000 uses a month. 50,000 uses a month cost $9.00 on the Starter plan.