# Confidence Interval Calculator

> Confidence interval calculator for a mean (z or t) or a proportion (Wilson and Wald), from summary statistics or raw data, with steps and a plot.

Interactive calculator: https://calculatorsplatform.com/c/confidence-interval/
Category: Math & Statistics Calculators
Calculations run in the browser; inputs can be prefilled through URL parameters and shared with the Share button.

## What a confidence interval means

A sample mean or percentage is only an estimate of the true population value. A **confidence interval** puts a range around the estimate that reflects sampling error: estimate ± margin of error.

A 95% confidence level describes the method, not one particular interval. If you repeated the study many times and built an interval each time, about 95% of those intervals would contain the true value. It is not quite right to say there is a 95% probability that the true mean is inside this specific interval — but "we are 95% confident" is the accepted plain-language summary.

## Formulas: z, t and the Wilson score interval

**Mean, σ known** (rare in practice):

> x̄ ± z* · σ ÷ √n

**Mean, σ unknown** (the usual case) — replace σ with the sample standard deviation s and z* with Student's t* with n − 1 degrees of freedom:

> x̄ ± t*(n−1) · s ÷ √n

The t distribution has heavier tails than the normal, which widens the interval to account for the uncertainty in s. For 95% confidence, t* is 12.71 with 1 df, 2.262 with 9 df, 2.064 with 24 df and approaches 1.960 as n grows.

**Proportion.** With x successes in n trials, p̂ = x ÷ n. The textbook **Wald** interval is p̂ ± z*·√(p̂(1 − p̂) ÷ n). It is simple but performs badly for small n or proportions near 0% or 100% — at x = 0 it has zero width. The **Wilson score** interval fixes this:

> (p̂ + z²/2n ± z·√(p̂(1−p̂)/n + z²/4n²)) ÷ (1 + z²/n)

Its actual coverage stays close to the nominal level, which is why Agresti & Coull, Newcombe and most modern texts recommend it. The calculator shows both and uses Wilson for the headline.

## Worked examples

**Mean.** A sample of n = 25 has x̄ = 50 and s = 10; σ is unknown.

1. SE = 10 ÷ √25 = 2
2. t* with 24 df at 95% = 2.0639
3. Margin of error = 2.0639 × 2 = 4.128
4. Interval: **45.87 to 54.13**

If σ = 10 were known, z* = 1.96 would give the slightly narrower 46.08 to 53.92.

**Proportion.** 56 of 80 customers (70%) say they would buy again. The 95% Wilson interval is **59.23% to 78.94%**; the Wald interval is 59.96% to 80.04%. Notice that Wilson is pulled slightly toward 50%.

## Assumptions and common mistakes

- The data should be a random sample of independent observations.
- For a t interval with fewer than about 30 observations, the population should be roughly normal; check a histogram for strong skew or outliers.
- A confidence interval covers sampling error only — not measurement bias or a non-representative sample.
- Overlapping intervals for two groups do not prove the groups are equal; compare them with a proper two-sample test.
- To plan how many observations you need for a target width, use the [sample size calculator](https://calculatorsplatform.com/c/sample-size/).

## Frequently asked questions

### When should I use t instead of z?

Use t whenever the standard deviation comes from the same sample — which is almost always. Use z only when the population σ is genuinely known, or for proportions.

### Why does a 99% interval come out wider than a 95% one?

To be more confident of capturing the true value you need a wider net. The critical value rises from 1.96 to 2.576, so the margin of error grows by about 31%.

### Why is the Wilson interval not symmetric around p̂?

Proportions are bounded by 0 and 1, so uncertainty is lopsided near the edges. Wilson's centre is shifted toward 50%, which keeps the interval inside 0–100% and gives better coverage.

### How can I make the interval narrower?

Increase the sample size (the width shrinks with √n), reduce measurement variability, or accept a lower confidence level.

## Sources

- [NIST/SEMATECH e-Handbook — Confidence limits for the mean](https://www.itl.nist.gov/div898/handbook/eda/section3/eda352.htm)
- [Newcombe, R. G. (1998) Two-sided confidence intervals for the single proportion, Statistics in Medicine 17](https://doi.org/10.1002/(SICI)1097-0258(19980430)17:8%3C857::AID-SIM777%3E3.0.CO;2-E)
- [Agresti, A. & Coull, B. (1998) Approximate is better than exact for interval estimation of binomial proportions](https://doi.org/10.1080/00031305.1998.10480550)

## Related calculators

- [Sample Size Calculator](https://calculatorsplatform.com/c/sample-size/index.md)
- [Z-Score Calculator](https://calculatorsplatform.com/c/z-score/index.md)
- [Standard Deviation Calculator](https://calculatorsplatform.com/c/standard-deviation/index.md)
- [Mean, Median, Mode Calculator](https://calculatorsplatform.com/c/mean-median-mode/index.md)
- [Probability Calculator](https://calculatorsplatform.com/c/probability/index.md)
- [Percentage Calculator](https://calculatorsplatform.com/c/percentage/index.md)

---
Source: CalculatorsPlatform (https://calculatorsplatform.com/c/confidence-interval/). Last reviewed 2026-11-25. Please link to the calculator page when citing.
