{
  "schemaVersion": 1,
  "slug": "oz-ml-calculator",
  "category": "conversion",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "095490c8c4c6e63dc0d02d9c78675fad550e19876e242b2f116b5677cdebb4d1",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/oz-ml-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "V_ml = V × {US: 29.5735295625, UK: 28.4130625}; fl oz US = V_ml ÷ 29.5735295625; cups = V_ml ÷ 236.5882365",
    "vars": [
      [
        "V",
        "Input value"
      ],
      [
        "V_ml",
        "Volume in millilitres"
      ],
      [
        "{US,UK}",
        "Selected fl oz standard"
      ]
    ],
    "note": "Choose the direction: US fl oz and UK fl oz use different exact factors; the reverse conversion divides by the US factor, and 1 US cup = 236.5882365 ml."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-04",
    "sources": [
      {
        "name": "NIST SP 811 — Conversion factors by quantity",
        "url": "https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors/nist-guide-si-appendix-b9"
      }
    ],
    "basis": "1 US fluid ounce = 29.5735295625 mL; 1 imperial fluid ounce = 28.4130625 mL.",
    "limitations": "US customary and imperial liquid measures differ. This is volume, not ingredient mass; no density conversion is performed.",
    "implementationHash": "095490c8c4c6e63dc0d02d9c78675fad550e19876e242b2f116b5677cdebb4d1",
    "domain": "conversion"
  },
  "contract": {
    "compute": "const F={\"floz\":29.5735295625,\"flozuk\":28.4130625,\"ml\":1}, U={\"floz\":\"US fl oz\",\"flozuk\":\"UK fl oz\",\"ml\":\"mL\"}, L={\"oz2ml\":[\"floz\",\"ml\"],\"ukoz2ml\":[\"flozuk\",\"ml\"],\"ml2oz\":[\"ml\",\"floz\"]}; const pair=Object.prototype.hasOwnProperty.call(L,direction)?L[direction]:[from,to], source=pair[0], target=pair[1]; if(!Number.isFinite(value)||value<0||value>1000000000||!Object.prototype.hasOwnProperty.call(F,source)||!Object.prototype.hasOwnProperty.call(F,target))return {\"result\":null,\"ml\":null,\"flOzUS\":null,\"flOzUK\":null,\"cups\":null,\"__error\":\"inputError\"}; const base=value*F[source], out=(function(value,direction){const ml = direction === 'ml2oz' ? value : value*(direction === 'ukoz2ml' ? 28.4130625 : 29.5735295625); const flOzUS = ml/29.5735295625; return { result: direction === 'ml2oz' ? flOzUS : ml, ml, flOzUS, flOzUK: ml/28.4130625, cups: ml/236.5882365 };})(base/F[\"floz\"],\"oz2ml\"); if(out.__error)return {...{\"result\":null,\"ml\":null,\"flOzUS\":null,\"flOzUK\":null,\"cups\":null},...out}; out.result=value*(F[source]/F[target]);out.__resultUnit=U[target];out.__unitRatio=F[target]/F[source];return out;",
    "inputs": [
      {
        "name": "value",
        "type": "number",
        "default": 8,
        "min": 0,
        "max": 1000000000,
        "step": 0.01,
        "requiredValue": true,
        "strictRange": true
      },
      {
        "name": "direction",
        "type": "select",
        "default": "auto",
        "options": [
          {
            "value": "auto"
          },
          {
            "value": "oz2ml"
          },
          {
            "value": "ukoz2ml"
          },
          {
            "value": "ml2oz"
          }
        ],
        "showWhen": {
          "from": []
        }
      },
      {
        "name": "precision",
        "type": "select",
        "default": 4,
        "options": [
          {
            "value": 0
          },
          {
            "value": 2
          },
          {
            "value": 4
          },
          {
            "value": 6
          }
        ]
      },
      {
        "name": "from",
        "type": "select",
        "default": "floz",
        "options": [
          {
            "value": "floz"
          },
          {
            "value": "flozuk"
          },
          {
            "value": "ml"
          }
        ]
      },
      {
        "name": "to",
        "type": "select",
        "default": "ml",
        "options": [
          {
            "value": "ml"
          },
          {
            "value": "floz"
          },
          {
            "value": "flozuk"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "result",
        "precision": 4,
        "unit": "",
        "precisionField": "precision",
        "unitField": "__resultUnit",
        "trimTrailingZeros": true,
        "notation": "auto"
      },
      {
        "name": "ml",
        "precision": 3,
        "unit": "ml",
        "notation": "auto",
        "showWhen": {
          "to": [
            "floz",
            "flozuk"
          ]
        }
      },
      {
        "name": "flOzUS",
        "precision": 4,
        "unit": "fl oz",
        "notation": "auto",
        "showWhen": {
          "to": [
            "flozuk",
            "ml"
          ]
        }
      },
      {
        "name": "flOzUK",
        "precision": 4,
        "unit": "fl oz",
        "notation": "auto",
        "showWhen": {
          "to": [
            "floz",
            "ml"
          ]
        }
      },
      {
        "name": "cups",
        "precision": 4,
        "unit": "cups",
        "notation": "auto"
      }
    ],
    "interpret": null
  }
}
