Article — Confidence Interval Calculator
Confidence interval calculator
A confidence interval (CI) gives a range that probably contains the true population parameter, given a sample estimate. For a 95% CI of a mean, the formula is x̄ ± t · (s/√n). For a proportion, p̂ ± z · √(p̂(1−p̂)/n). The result is two numbers — a lower and upper bound — plus a confidence level that describes the procedure's long-run capture rate.
Confidence intervals are how careful statisticians communicate uncertainty. A point estimate of "48% support" hides whether you're looking at a tight 47.5–48.5% poll of 10,000 voters or a sloppy 38–58% sample of 100. The CI tells you which one you have. This calculator handles both means and proportions across the standard 80% to 99.9% confidence levels.
What is a confidence interval?
A confidence interval is the range you publish around a sample-based estimate. It says: "I'm fairly sure the true value lies somewhere in this band, and 'fairly sure' means I picked a procedure that would capture the truth in 95% of identical experiments." The interval moves around when you take a different sample; the population parameter stays put.
The subtlety: the procedure has the probability, not the interval. For your specific CI of [47%, 51%], the true proportion either is inside or it isn't. Bayesian credible intervals support the more intuitive 95-percent-probability statement but rest on prior distributions. Most reported intervals in journalism and clinical trials are frequentist 95% CIs.
Jerzy Neyman, the Polish-born statistician who introduced confidence intervals in 1937, deliberately avoided the word "probability" in their definition. He knew the frequentist interpretation was counterintuitive and worried that calling them "probability intervals" would mislead readers.
The confidence interval formula
The general form is identical for every CI: a point estimate plus or minus a margin of error. The margin is a critical value times the standard error of the estimate.
CI = estimate ± critical × SEMean: x̄ ± t · s/√n Proportion: p̂ ± z · √(p̂q̂/n)z₉₅ = 1.96 z₉₉ = 2.576 z₉₉.₉ = 3.291The critical value comes from the standard normal distribution (z) when the population standard deviation is known, or from the Student t-distribution when it must be estimated. Almost no real-world problem knows σ, so t is the default. For large samples (n > 30), t critical values are so close to z that the choice doesn't matter much in practice.
Confidence interval for the mean
To build a confidence interval for a population mean, you need three numbers: the sample mean x̄, the sample standard deviation s, and the sample size n. Compute the standard error as s/√n, look up the t critical value for n−1 degrees of freedom at your confidence level, multiply, and add/subtract from x̄.
Example: a study of resting heart rate in 50 adults gives x̄ = 72 bpm, s = 10 bpm. Standard error = 10/√50 = 1.414. For 95% CI, t₀.₀₂₅, 49 ≈ 2.01. Margin of error = 2.01 × 1.414 = 2.84 bpm. CI = [69.2, 74.8] bpm. The interpretation: across many studies of 50 adults, intervals built this way would cover the population mean 95% of the time.
Confidence interval for a proportion
Proportions use the normal approximation when the sample is large enough. The standard error is √(p̂(1−p̂)/n), and the critical value comes from the standard normal table — no degrees of freedom because the distribution doesn't depend on a sample SD estimate.
A pre-election poll of 1067 likely voters finds 48% support for Candidate A. Standard error = √(0.48 × 0.52 / 1067) = 0.0153. For 95% CI, z = 1.96. Margin of error = 1.96 × 0.0153 = 0.030 = 3.0 percentage points. CI = [45.0%, 51.0%]. That's where the famous "n = 1000 with ±3 points" polling convention comes from — it's chosen to give exactly that margin of error at 95% confidence.
The Wald formula above breaks down for small samples or extreme proportions. Both n·p̂ and n·(1−p̂) must exceed 5 (some texts say 10 or 15). Below that threshold, use Wilson's score interval or the Clopper–Pearson exact interval. The calculator flags small samples.
Sample size and confidence interval width
The margin of error shrinks as 1/√n. To halve the CI width, quadruple the sample. To get from ±5 points to ±2.5 points at 95% confidence, you move from n = 384 to n = 1537. To reach ±1 point, you need 9604. The diminishing return is why polls cluster around 1000 — past that point, additional respondents buy very little extra precision per dollar.
The same scaling applies to means. If a pilot study with n = 30 gives a CI of x̄ ± 5 units, expanding to n = 120 will give roughly x̄ ± 2.5 units. Doubling the budget halves the noise, no more.
For polling sample-size planning: at 95% confidence with worst-case p̂ = 0.5, n ≈ 1067 gives ±3 percentage points. n ≈ 600 gives ±4 points. n ≈ 384 gives ±5 points. These are the standard pollster targets.
Common confidence interval mistakes
The single most reported misinterpretation is "there's a 95% chance the true value lies in this interval". That statement describes a Bayesian credible interval, not a frequentist CI. The frequentist version says only that the procedure captures the truth 95% of the time across repeated experiments. For your specific interval, the true value is either inside or outside with probability 1 or 0 — you just don't know which.
The second mistake is reading non-overlap as significance. Two CIs that do not overlap suggest a significant difference, but two CIs that do overlap don't necessarily mean no difference. The proper test is whether the CI of the difference (not the comparison of two individual CIs) includes zero. The two perspectives give different conclusions in roughly 5–15% of cases.
The third is reporting margin of error without confidence level. A poll that says "±3 points" without specifying 95% is ambiguous — the same data can give ±2.5 points at 90% or ±4 points at 99%. Always pair margin of error with the level it was computed at.
The CI captures sampling variability, not bias. If your sample is non-random (online opt-in panel, convenience sample, missing demographics), a tight CI gives false confidence. Bias beats noise — a biased ±2 point poll is worse than an unbiased ±5 point poll.
A short history of confidence intervals
Jerzy Neyman introduced confidence intervals in 1937 as a deliberate alternative to R.A. Fisher's fiducial probability. The two methods produced similar answers for simple problems but differed sharply for some non-parametric and multi-parameter cases. The Neyman–Fisher feud over fiducial vs frequentist inference ran for decades and never fully resolved; modern statistics adopted Neyman's frequentist CIs but kept Fisher's significance-testing machinery alongside them.
The 1990s revival of Bayesian methods, powered by Markov-chain Monte Carlo, brought credible intervals into routine use. Biomedical and economics literature increasingly reports both — frequentist for the older record, Bayesian when prior information matters.