{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://askcalculators.com/calculator/sample-size-calculator/schema.json",
  "title": "Sample Size Calculator inputs",
  "description": "Calculate a required survey sample size or the margin of error for a proportion, including finite-population correction.",
  "type": "object",
  "properties": {
    "calculation": {
      "title": "Calculate",
      "type": "string",
      "default": "sample-size",
      "enum": [
        "sample-size",
        "margin-error"
      ],
      "x-optionLabels": {
        "sample-size": "Required sample size",
        "margin-error": "Margin of error"
      }
    },
    "confidenceLevel": {
      "title": "Confidence level",
      "type": "number",
      "default": 95,
      "enum": [
        80,
        85,
        90,
        92,
        95,
        96,
        98,
        99,
        99.9
      ],
      "x-optionLabels": {
        "80": "80%",
        "85": "85%",
        "90": "90%",
        "92": "92%",
        "95": "95%",
        "96": "96%",
        "98": "98%",
        "99": "99%",
        "99.9": "99.9%"
      }
    },
    "populationProportion": {
      "title": "Population proportion",
      "type": "number",
      "description": "Use 50% when the proportion is unknown.",
      "default": 50,
      "minimum": 0.0001,
      "maximum": 99.9999,
      "x-step": 0.01,
      "x-unit": "percent"
    },
    "populationSize": {
      "title": "Population size (optional)",
      "type": "number",
      "minimum": 1,
      "x-step": 1,
      "multipleOf": 1
    },
    "marginOfError": {
      "title": "Desired margin of error",
      "type": "number",
      "default": 5,
      "minimum": 0.0001,
      "maximum": 99.9999,
      "x-step": 0.01,
      "x-unit": "percent",
      "x-showWhen": {
        "field": "calculation",
        "equals": "sample-size"
      }
    },
    "sampleSize": {
      "title": "Observed sample size",
      "type": "number",
      "default": 385,
      "minimum": 1,
      "x-step": 1,
      "multipleOf": 1,
      "x-showWhen": {
        "field": "calculation",
        "equals": "margin-error"
      }
    }
  },
  "required": [
    "calculation",
    "confidenceLevel",
    "populationProportion"
  ],
  "allOf": [
    {
      "if": {
        "properties": {
          "calculation": {
            "const": "sample-size"
          }
        },
        "required": [
          "calculation"
        ]
      },
      "then": {
        "required": [
          "marginOfError"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "calculation": {
            "const": "margin-error"
          }
        },
        "required": [
          "calculation"
        ]
      },
      "then": {
        "required": [
          "sampleSize"
        ]
      }
    }
  ],
  "additionalProperties": false,
  "x-askcalculators": {
    "version": "2.0.0",
    "calculatorUrl": "https://askcalculators.com/calculator/sample-size-calculator/",
    "queryExample": "https://askcalculators.com/calculator/sample-size-calculator/?calculation=sample-size&confidenceLevel=95&populationProportion=50&marginOfError=5",
    "migrationStatus": "migrated",
    "reviewStatus": "pending",
    "pageStatus": "live",
    "workStatus": "pending",
    "migratedDate": "2026-08-25",
    "formula": {
      "expression": "n₀=z²p(1−p)/e²; finite n=n₀/[1+(n₀−1)/N]; e=z√[p(1−p)/n] with finite correction."
    },
    "quality": {
      "availability": "live",
      "technicalReviewRecord": "/reviews/sample-size-calculator.json",
      "qualifiedReview": "pending",
      "qualifiedReviewer": null,
      "qualifiedReviewDate": null,
      "formulaVersion": "2.0.0",
      "referenceCoverage": "references-listed",
      "releaseTestScope": "Catalog and regression checks are not a professional formula audit; consult release evidence.",
      "historicalMetadataDate": "2026-08-25",
      "historicalMetadataNotice": "The imported date is not evidence of a completed human review."
    },
    "outputs": {
      "requiredSampleSize": {
        "title": "Required sample size",
        "type": "number",
        "x-format": "integer",
        "x-primary": true
      },
      "marginOfErrorResult": {
        "title": "Margin of error",
        "type": "number",
        "x-format": "percent",
        "x-digits": 4
      },
      "confidenceInterval": {
        "title": "Confidence interval",
        "type": "string",
        "x-format": "text"
      },
      "criticalZ": {
        "title": "Critical z-score",
        "type": "number",
        "x-format": "number",
        "x-digits": 5
      },
      "finiteCorrection": {
        "title": "Finite-population correction",
        "type": "number",
        "x-format": "number",
        "x-digits": 6
      }
    }
  }
}
