{
  "schemaVersion": 1,
  "slug": "ph-calculator",
  "category": "science",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "2ed8a1b90530edf9a4b1eb3cbb4c2935681f14d445796c2f36c4ea11009958fa",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/ph-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": "pH = −log10(H); H = {c, m = 0; Kw ÷ c, m = 1}; Kw = 10^(−(14 − 0.02·(T − 25)))",
    "vars": [
      [
        "pH",
        "pH value"
      ],
      [
        "H",
        "Equivalent human age (years)"
      ],
      [
        "c",
        "Entered concentration (M)"
      ],
      [
        "Kw",
        "Water ion product"
      ],
      [
        "T",
        "Temperature (°C)"
      ],
      [
        "m",
        "Substance code: 0 acid, 1 base"
      ]
    ],
    "note": "m = 0 for acid, m = 1 for base. pOH = 14 − pH, [OH⁻] = Kw ÷ H; c floor 1e-10 M; type thresholds pH 3/6.5/7.5/11."
  },
  "externalEvidence": {
    "reviewedAt": "2026-09-26",
    "sources": [
      {
        "name": "IAPWS — Revised Release on the Ionization Constant of H₂O",
        "url": "https://www.iapws.org/relguide/Ionization.html"
      }
    ]
  },
  "contract": {
    "compute": "const c=concentration,kw=1e-14,h=substance==='acid'?c:kw/c,oh=kw/h,ph=-Math.log10(h); return {ph,poh:14-ph,hydrogenIon:h,hydroxideIon:oh,solutionType:ph<3?'Strongly acidic':ph<6.5?'Acidic':ph<7.5?'Neutral':ph<11?'Basic':'Strongly basic',kw:kw.toExponential(3)};",
    "inputs": [
      {
        "name": "concentration",
        "type": "number",
        "default": 0.01,
        "min": 1e-10,
        "max": 100,
        "step": 1e-7
      },
      {
        "name": "substance",
        "type": "select",
        "default": "acid",
        "options": [
          {
            "value": "acid"
          },
          {
            "value": "base"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "ph",
        "precision": 2,
        "unit": ""
      },
      {
        "name": "poh",
        "precision": 2,
        "unit": ""
      },
      {
        "name": "hydrogenIon",
        "precision": 6,
        "unit": "M"
      },
      {
        "name": "hydroxideIon",
        "precision": 6,
        "unit": "M"
      },
      {
        "name": "solutionType",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "kw",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
