Confidence Interval Calculator

Confidence interval for the mean (Student t-distribution) or for a proportion (normal approximation).

Science Mean or proportion 80–99.9%
Rate this calculator · 5.0 (1)

Confidence Interval CI

CI = x̄ ± t · s/√n · or p̂ ± z · √(p̂q̂/n)

Instructions — Confidence Interval Calculator

1

Pick mean or proportion

Mean for continuous data (height, blood pressure, lab measurement). Proportion for binary outcomes — poll support, conversion rate, defect rate.

2

Enter your sample

Mean mode: type x̄ (sample mean), s (sample SD), and n (sample size). Proportion mode: type p̂ (between 0 and 1) and n. The calculator uses Student t for means and normal approximation for proportions.

3

Pick the confidence level

95% is the science standard. 90% is common in business analytics. 99% is used in medical and safety-critical work. Higher confidence = wider interval. The result shows the interval, margin of error, critical value, and standard error.

Rule of thumb: to halve the margin of error, you need 4× the sample size. Margin of error scales as 1/√n.
Proportions need n·p̂ ≥ 5 for the normal approximation. The calculator flags small samples.

Formulas

A confidence interval combines a point estimate with a margin of error. The margin of error equals the critical value times the standard error.

Mean CI (Student t)
$$ \bar{x} \pm t_{\alpha/2,\,n-1} \cdot \frac{s}{\sqrt{n}} $$
Use the t-distribution when σ is unknown (almost always in practice). Degrees of freedom: n − 1.
Proportion CI (Wald)
$$ \hat{p} \pm z_{\alpha/2} \cdot \sqrt{\frac{\hat{p}(1-\hat{p})}{n}} $$
Normal approximation. Valid when both n·p̂ ≥ 5 and n·(1−p̂) ≥ 5.
Standard Error of Mean
$$ SE = \frac{s}{\sqrt{n}} $$
Sample SD divided by the square root of sample size. SE shrinks as n grows.
Margin of Error
$$ ME = critical \cdot SE $$
For 95% CI of a mean, critical = t₀.₀₂₅, df. For a proportion, critical = z₀.₀₂₅ = 1.96.
Z critical values
$$ z_{90}=1.645 \;\; z_{95}=1.96 \;\; z_{99}=2.576 $$
Two-tailed critical values from the standard normal distribution. These are the standard choices in most fields.
Sample Size for Target ME
$$ n = \left(\frac{z_{\alpha/2}}{ME}\right)^2 \cdot \hat{p}(1-\hat{p}) $$
For ME = 3 pp and 95% CI, with p̂ = 0.5, you need n ≈ 1067. Polls of "about 1000" come from this formula.

Reference

Z and t Critical Values (two-tailed)
Levelαzt (df=10)t (df=30)t (df=100)
80%0.201.2821.3721.3101.290
90%0.101.6451.8121.6971.660
95%0.051.9602.2282.0421.984
99%0.012.5763.1692.7502.626
99.9%0.0013.2914.5873.6463.391

Sample size requirements

Required sample for a 95% CI of a proportion, given desired margin of error (p̂ assumed 0.5 — worst case).

ME → required n
ME (pp)n required
±1097
±5385
±31067
±22401
±19604
±0.538,416
Typical CI use
FieldTypical CI
Medical trials95% or 99%
Political polls95%
A/B testing90% or 95%
Quality control99%
Economic forecasts90%

Note: a 95% CI does not mean a 95% chance the true value lies in the interval — that's a Bayesian credible interval. The frequentist CI means: if you repeated the procedure many times, 95% of intervals constructed would contain the true parameter.

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.

Did you know

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.

Confidence interval formulas
CI = estimate ± critical × SE
Mean: x̄ ± t · s/√n Proportion: p̂ ± z · √(p̂q̂/n)
z₉₅ = 1.96 z₉₉ = 2.576 z₉₉.₉ = 3.291

The 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.

Small study (n=20)
±4.4 bpm
Wide CI, t = 2.09
Medium (n=100)
±2.0 bpm
Half as wide, t = 1.98
Large (n=400)
±1.0 bpm
Quarter width, t ≈ z

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.

Tip

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.

CIs assume the sample is representative

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.

FAQ

The procedure that built the interval would capture the true parameter in 95% of repeated samples. It is a statement about the procedure, not about your specific interval. For your one CI, the true mean either is or isn't inside — there is no probability attached to a fixed value.
For a mean: x̄ ± t · (s/√n), where t is the Student t critical value for df = n−1 at your confidence level. For a proportion: p̂ ± z · √(p̂(1−p̂)/n). The calculator picks the right distribution and degrees of freedom automatically.
Use z only when the population SD σ is known (rare in practice). Otherwise use t with df = n−1. For large n (above 30) the two are practically identical, but t is always the safer default. The calculator uses t for means.
Margin of error scales as 1/√n. To halve the margin of error, you need 4× the sample. Going from n = 100 to n = 400 cuts ME in half. This is why national polls cluster around n = 1000 — that gives roughly ±3 percentage points of ME at 95% confidence.
The 99% interval is wider because the critical value is larger (2.576 vs 1.960 for z). On the same data, a 99% CI is about 31% wider than a 95% CI. You trade precision for confidence — narrower means more precise but less certain to capture the true value.
Technically n ≥ 2 works mathematically, but the interval will be enormous. Practical guidelines: n ≥ 30 for the Central Limit Theorem to give a good normal shape; for proportions, n·p̂ ≥ 5 and n·(1−p̂) ≥ 5. Smaller samples need exact methods (Wilson, Clopper–Pearson).
Margin of error is half the width of the CI. If a poll reports 48% ± 3 pp, the 95% CI is [45%, 51%]. The margin equals the critical value times the standard error. Pollsters quote margin of error because it is more intuitive than a full interval.
Convention from R. A. Fisher in the 1920s. Fisher casually wrote that a one-in-twenty event was unusual enough to be noteworthy, and 95% (= 1 − 1/20) stuck as the default. There is nothing magical about it. Some fields use 99% (pharmaceuticals, particle physics) or 90% (business decision-making) instead.