Volume converter API
Convert between metric, US customary, imperial and cubic units of volume.
POST https://api.curatedapi.com/v1/calc/units/volume
- Version 1
- MCP tool
calc_units_volume - Try it in the browser
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.
Formula
result = value × factor(from_unit) ÷ factor(to_unit), factors in m³
- 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)
Inputs
Send numbers as strings to keep every digit. options sets precision and rounding (see numbers and rounding).
| Input | Type | Description |
|---|---|---|
value required |
decimal (string) | The amount to convert. Allowed: >= 0. |
from_unit required |
m3 | l | ml | cm3 | in3 | ft3 | yd3 | gal_us | qt_us | pt_us | cup_us | cup_us_legal | floz_us | tbsp_us | tsp_us | bbl_oil | gal_imp | qt_imp | pt_imp | floz_imp | 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 |
to_unit |
m3 | l | ml | cm3 | in3 | ft3 | yd3 | gal_us | qt_us | pt_us | cup_us | cup_us_legal | floz_us | tbsp_us | tsp_us | bbl_oil | gal_imp | qt_imp | pt_imp | floz_imp | 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 |
options.rounding |
half_even | half_up | half_down | up | down | ceiling | floor | Rounding mode applied once to each result. Default half_even. |
options.decimals |
integer | Round results to this many digits after the decimal point. |
options.significant_digits |
integer | Round results to this many significant digits. |
Result
Under result in the answer, next to exactness, precision, inputs, formula, references and warnings.
| Result | Type | Description |
|---|---|---|
result | decimal (string) | The converted value. |
factor | decimal (string) | How many to_unit make one from_unit (multiply by this to convert). |
all_units | list of object | The value expressed in every supported unit. |
Examples
One US gallon in litres
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"
}'
{
"calculator": "units/volume@1",
"result": {
"result": "3.785411784",
"factor": "3.785411784"
},
"exactness": {
"result": "exact",
"factor": "exact"
},
"precision": {
"rounding": "half_even",
"significant_digits": 15
},
"inputs": {
"value": "1",
"from_unit": "gal_us",
"to_unit": "l"
},
"formula": "result = value × factor(from_unit) ÷ factor(to_unit), factors in m³",
"references": [
{
"title": "NIST Special Publication 811 (2008), Appendix B: conversion factors",
"url": "https://www.nist.gov/pml/special-publication-811"
},
{
"title": "UK Weights and Measures Act 1985, Schedule 1 (imperial gallon)",
"url": "https://www.legislation.gov.uk/ukpga/1985/72/schedule/1"
},
{
"title": "21 CFR 101.9(b)(5)(viii): the 240 mL cup used on US nutrition labels",
"url": "https://www.law.cornell.edu/cfr/text/21/101.9"
}
],
"warnings": []
}
One imperial pint in millilitres
curl https://api.curatedapi.com/v1/calc/units/volume \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"value": "1",
"from_unit": "pt_imp",
"to_unit": "ml"
}'
{
"calculator": "units/volume@1",
"result": {
"result": "568.26125",
"factor": "568.26125"
},
"exactness": {
"result": "exact",
"factor": "exact"
},
"precision": {
"rounding": "half_even",
"significant_digits": 15
},
"inputs": {
"value": "1",
"from_unit": "pt_imp",
"to_unit": "ml"
},
"formula": "result = value × factor(from_unit) ÷ factor(to_unit), factors in m³",
"references": [
{
"title": "NIST Special Publication 811 (2008), Appendix B: conversion factors",
"url": "https://www.nist.gov/pml/special-publication-811"
},
{
"title": "UK Weights and Measures Act 1985, Schedule 1 (imperial gallon)",
"url": "https://www.legislation.gov.uk/ukpga/1985/72/schedule/1"
},
{
"title": "21 CFR 101.9(b)(5)(viii): the 240 mL cup used on US nutrition labels",
"url": "https://www.law.cornell.edu/cfr/text/21/101.9"
}
],
"warnings": []
}
References
- NIST Special Publication 811 (2008), Appendix B: conversion factors
- UK Weights and Measures Act 1985, Schedule 1 (imperial gallon)
- 21 CFR 101.9(b)(5)(viii): the 240 mL cup used on US nutrition labels
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.
Errors share one format; see errors. Billing, retries and batches work the same for every endpoint.