{
  "schemaVersion": 1,
  "slug": "fertilizer-calculator",
  "category": "gardening",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "0c3185c6e3e49cec9bd040c8d38047fb6b23ce3015ee3b3e8b06cf759b098adf",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/fertilizer-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": "Q=(A÷1000×r)÷(p÷100); bags=ceil(Q÷w)",
    "vars": [
      [
        "A",
        "area (sq ft)"
      ],
      [
        "r",
        "selected nutrient target (lb/1,000 sq ft)"
      ],
      [
        "p",
        "matching label percentage"
      ],
      [
        "Q",
        "fertilizer product (lb)"
      ],
      [
        "w",
        "bag weight (lb)"
      ]
    ],
    "note": "NPK label percentages are N, P₂O₅ and K₂O by weight. Match the target to the same nutrient basis. A zero selected percentage is invalid; bags round up."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "University of Minnesota Extension — Fertilizer labels and soil tests",
        "url": "https://extension.umn.edu/manage-soil-nutrients/quick-guide-fertilizing-plants"
      }
    ],
    "referenceRole": "input",
    "implementationHash": "0c3185c6e3e49cec9bd040c8d38047fb6b23ce3015ee3b3e8b06cf759b098adf",
    "basis": "Q=(A÷1000×r)÷(p÷100); bags=ceil(Q÷w)",
    "limitations": "Use the cited guidance and your own measurements, bills or product specifications to choose inputs. Sample defaults are not current local data."
  },
  "contract": {
    "compute": "const pct=nutrient===\"nitrogen\"?nPercent:nutrient===\"phosphorus\"?pPercent:kPercent; const nutrientNeeded=area/1000*targetRate; if(pct<=0)return{nutrientNeeded,nutrientPercent:pct,productNeeded:null,bags:null,perThousand:null,__error:\"inputError\"}; const productNeeded=nutrientNeeded/(pct/100); return {nutrientNeeded,nutrientPercent:pct,productNeeded,bags:Math.ceil(productNeeded/bagWeight),perThousand:productNeeded/(area/1000)};",
    "inputs": [
      {
        "name": "area",
        "type": "number",
        "default": 500,
        "min": 1,
        "max": 500000,
        "step": 10
      },
      {
        "name": "nutrient",
        "type": "select",
        "default": "nitrogen",
        "options": [
          {
            "value": "nitrogen"
          },
          {
            "value": "phosphorus"
          },
          {
            "value": "potassium"
          }
        ]
      },
      {
        "name": "targetRate",
        "type": "number",
        "default": 0.75,
        "min": 0.05,
        "max": 5,
        "step": 0.05,
        "slider": true
      },
      {
        "name": "nPercent",
        "type": "number",
        "default": 10,
        "min": 0,
        "max": 60,
        "step": 1,
        "slider": true
      },
      {
        "name": "pPercent",
        "type": "number",
        "default": 10,
        "min": 0,
        "max": 60,
        "step": 1,
        "slider": true
      },
      {
        "name": "kPercent",
        "type": "number",
        "default": 10,
        "min": 0,
        "max": 60,
        "step": 1,
        "slider": true
      },
      {
        "name": "bagWeight",
        "type": "number",
        "default": 40,
        "min": 1,
        "max": 100,
        "step": 1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "nutrientNeeded",
        "precision": 2,
        "unit": "lb"
      },
      {
        "name": "nutrientPercent",
        "precision": 0,
        "unit": "%"
      },
      {
        "name": "productNeeded",
        "precision": 2,
        "unit": "lb"
      },
      {
        "name": "bags",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "perThousand",
        "precision": 2,
        "unit": "lb per 1,000 sq ft"
      }
    ],
    "interpret": null
  }
}
