{
    "name": "Confidence Interval Calculator",
    "url": "https://calculators.geekmidst.com/calculators/confidence-interval-calculator",
    "markdown": "https://calculators.geekmidst.com/calculators/confidence-interval-calculator.md",
    "category": "Statistics & probability",
    "description": "Find the confidence interval for a population mean from the sample mean, standard deviation and size, using the t-distribution or a known σ.",
    "summary": "A confidence interval for a mean is the sample mean plus or minus a critical value times the standard error. Use t when the standard deviation comes from your sample.",
    "also_called": [
        "Margin of error calculator (mean)"
    ],
    "applies_to": "Worldwide",
    "last_updated": "2026-10-29",
    "computation": "Results are computed in the visitor’s browser on the HTML page. This API describes the calculator; it does not compute results.",
    "inputs": [
        {
            "name": "mean",
            "label": "Sample mean (x̄)",
            "type": "number",
            "default": "50"
        },
        {
            "name": "sd",
            "label": "Standard deviation",
            "type": "number",
            "default": "10"
        },
        {
            "name": "n",
            "label": "Sample size (n)",
            "type": "number",
            "default": "25"
        },
        {
            "name": "confidence",
            "label": "Confidence level",
            "type": "number",
            "default": "95",
            "unit": "%"
        },
        {
            "name": "method",
            "label": "Method",
            "type": "segmented",
            "default": "t",
            "options": {
                "t": "t (σ unknown)",
                "z": "z (σ known)"
            }
        }
    ],
    "outputs": [
        {
            "key": "interval",
            "label": "Confidence interval",
            "format": "text"
        },
        {
            "key": "lower",
            "label": "Lower bound",
            "format": "number"
        },
        {
            "key": "upper",
            "label": "Upper bound",
            "format": "number"
        },
        {
            "key": "margin",
            "label": "Margin of error (±)",
            "format": "number"
        },
        {
            "key": "se",
            "label": "Standard error",
            "format": "number"
        },
        {
            "key": "critical",
            "label": "Critical value (t* or z*)",
            "format": "number"
        },
        {
            "key": "df",
            "label": "Degrees of freedom (t only)",
            "format": "integer"
        }
    ],
    "formula": {
        "text": "CI = x̄ ± c × s ÷ √n, where c = t(1 − α/2, n − 1) or z(1 − α/2), and α = 1 − confidence",
        "variables": {
            "x̄": "sample mean",
            "s": "standard deviation",
            "n": "sample size",
            "c": "two-sided critical value"
        }
    },
    "worked_example": {
        "inputs": {
            "mean": "50",
            "sd": "10",
            "n": "25",
            "confidence": "95",
            "method": "t"
        },
        "steps": [
            "Standard error = 10 ÷ √25 = 2.",
            "t* for 95% with 24 degrees of freedom = 2.0639.",
            "Margin = 2.0639 × 2 = 4.1278, so the interval is 50 ± 4.1278."
        ],
        "result": "With a sample mean of 50, s = 10 and n = 25, the 95% confidence interval for the mean is 45.87 to 54.13."
    },
    "interpretation": "If you repeated the sampling many times, about 95% of intervals built this way would contain the true mean. A narrower interval needs a larger sample: halving the margin takes roughly four times as many observations.",
    "assumptions": [
        "Observations are independent and come from a random sample.",
        "The population is roughly normal, or the sample is large enough (about 30+) for the mean to be close to normal."
    ],
    "limitations": [
        "This is for a single mean. Proportions, differences between groups and paired data need different formulas.",
        "Strong skew or outliers in small samples make the interval unreliable."
    ],
    "rules": null,
    "faqs": [
        {
            "question": "Should I use t or z?",
            "answer": "Use t whenever the standard deviation is estimated from the sample, which is almost always. Use z only when σ is genuinely known in advance. For large n they give nearly the same answer."
        },
        {
            "question": "Does a 95% interval mean a 95% chance the mean is inside?",
            "answer": "Not strictly. The true mean is fixed; the 95% describes how often the method captures it over repeated samples."
        }
    ],
    "sources": [],
    "related": [
        {
            "name": "Z-score Calculator",
            "url": "https://calculators.geekmidst.com/calculators/z-score-calculator"
        },
        {
            "name": "P-value Calculator",
            "url": "https://calculators.geekmidst.com/calculators/p-value-calculator"
        },
        {
            "name": "Standard Deviation Calculator",
            "url": "https://calculators.geekmidst.com/calculators/standard-deviation-calculator"
        },
        {
            "name": "Average Calculator",
            "url": "https://calculators.geekmidst.com/calculators/average-calculator"
        }
    ],
    "disclaimer": null,
    "publisher": "GM¹X CalcVerse"
}