Confidence Interval Calculator
Use this confidence interval calculator to find the confidence interval for a population mean — with z or t selected automatically — or for a proportion, with both the Wald and Wilson intervals shown. You can also work out the sample size you need for a target margin of error.

Mode:
95% confidence interval: [96.33, 103.68]
Standard error (SE): 1.8750 Margin of error (ME): 3.6750
Critical value: 1.960 Distribution used: z (σ unknown, n ≥ 30)
We are 95% confident the true population mean lies between 96.33 and 103.68.
Formula
Confidence interval = estimate ± critical value × standard error. Standard error of the mean = s ÷ √n. Standard error of a proportion = √(p̂(1 − p̂) ÷ n).
- Use z when the population standard deviation σ is known, or when n ≥ 30 (the central limit theorem makes the sampling distribution approximately normal).
- Use t when σ is unknown and n < 30, with degrees of freedom df = n − 1 — the t distribution has fatter tails, so the interval is wider.
- The Wald proportion interval is p̂ ± z × SE — it needs at least 10 successes and 10 failures, and it can spill outside [0, 1].
- The Wilson (score) interval is (p̂ + z²/2n ± z√(p̂(1−p̂)/n + z²/4n²)) ÷ (1 + z²/n) — it stays inside [0, 1] and behaves better for small samples and extreme proportions.
- Sample size for a mean: n = (z × σ ÷ E)². For a proportion: n = z² × p(1−p) ÷ E² — always rounded up, and p = 0.5 gives the largest (safest) sample size.
- “95% confident” describes the method, not this interval: about 95 of 100 intervals built this way contain the true value. It does not mean there is a 95% probability this particular interval contains it.
Worked Example
A sample of 64 measurements has mean 100 and standard deviation 15. Find the 95% confidence interval for the population mean.
- Standard error: SE = 15 ÷ √64 = 15 ÷ 8 = 1.875.
- Distribution: σ is unknown and n = 64 ≥ 30, so use z. For 95% confidence, z* = 1.960.
- Margin of error: ME = 1.960 × 1.875 = 3.675.
- Confidence interval: 100 ± 3.675 = [96.325, 103.675].
Answer: the 95% confidence interval is [96.33, 103.68] — we are 95% confident the true population mean lies between 96.33 and 103.68.
(a) Small sample (t): n = 10, mean 25, s = 2, 95% → σ unknown and n < 30, so t with df = 9, t* = 2.262; SE = 2 ÷ √10 = 0.6325; ME = 2.262 × 0.6325 = 1.4307; CI = [23.57, 26.43]. The same data with z would give [23.76, 26.24] — the t interval is correctly wider.
(b) Proportion: p̂ = 0.60, n = 100, 95% → SE = √(0.6 × 0.4 ÷ 100) = 0.0490; Wald ME = 1.960 × 0.0490 = 0.0960 → Wald CI [0.5040, 0.6960]; Wilson CI [0.5020, 0.6906]. Note the Wilson interval is not symmetric around 0.60 — that is correct, not an error.
(c) Sample size, mean: σ = 15, target margin E = 2, 95% → n = (1.960 × 15 ÷ 2)² = 216.09 → round up to 217.
(d) Sample size, proportion: p = 0.5, target margin E = 0.03, 95% → n = 0.25 × (1.960 ÷ 0.03)² = 1,067.11 → round up to 1,068.
(e) Published cross-checks: n = 30, mean 25, s = 2 → SE 0.3651, ME 0.7157, CI [24.2843, 25.7157]; n = 36, mean 100, σ = 15 → SE 2.5, ME 4.9, CI [95.10, 104.90]. Switch the widget to 4 decimal places to see the full precision.
Critical Values
| Confidence level | z* | df | t* (95%) | df | t* (95%) |
|---|---|---|---|---|---|
| 90% | 1.645 | 1 | 12.706 | 15 | 2.131 |
| 95% | 1.960 | 5 | 2.571 | 20 | 2.086 |
| 99% | 2.576 | 9 | 2.262 | 24 | 2.064 |
| 99.9% | 3.291 | 10 | 2.228 | 29 | 2.045 |
How the Interval Narrows as n Grows
Mean 100, s = 15, 95% confidence:
| n | Distribution | SE | Margin of error | 95% CI |
|---|---|---|---|---|
| 10 | t (df 9) | 4.743 | 10.73 | [89.27, 110.73] |
| 30 | z | 2.739 | 5.37 | [94.63, 105.37] |
| 64 | z | 1.875 | 3.67 | [96.33, 103.68] |
| 100 | z | 1.500 | 2.94 | [97.06, 102.94] |
| 400 | z | 0.750 | 1.47 | [98.53, 101.47] |
Frequently Asked Questions
It describes the method, not this one interval: if you repeated the sampling and the calculation many times, about 95% of the intervals you built would contain the true population value. It does not mean there is a 95% probability that this particular interval contains it.
Use z when the population standard deviation is known, or when the sample is large (n of 30 or more) so the central limit theorem applies. Use t when the population standard deviation is unknown and the sample is small (n under 30), with df = n - 1. The widget selects automatically and lets you override it.
The t distribution has fatter tails than the normal distribution, because estimating the standard deviation from a small sample adds uncertainty. As the sample grows the t distribution converges on the normal one - at df 29 the 95% critical value is 2.045, already close to the z value of 1.960.
The Wald interval (sample proportion plus or minus z times the standard error) is the textbook default, but it breaks down for small samples and proportions near 0 or 1, and it can spill outside [0, 1]. The Wilson interval stays inside [0, 1] and is more accurate there, so the widget shows both and recommends Wilson when n is small or the sample proportion is extreme.
More Calculators
- AGI Calculator
- Business Day Calculator
- Tire Size Calculator
- HSA Calculator
- Auto Loan Calculator
- Time Calculator