Confidence Interval Calculator
This confidence interval calculator gives the range of plausible values for a population mean or proportion from your sample. For a mean, enter the sample mean, standard deviation and sample size; for a proportion, the number of successes and the sample size. Choose a confidence level from 80% to 99.9% and you get the interval, margin of error, critical value and a table comparing every level.
Updated
Results
- Margin of error (±)Critical value × standard error
- Standard errorMean mode: s (or σ) / √n
- Sample proportion (p̂)Successes ÷ n
- Wald lower boundClipped at 0%
- Wald upper boundClipped at 100%
- Margin of error, Wald (± points)
- Wilson centerMidpoint of the Wilson interval
- Critical value
- Distribution used
- Degrees of freedomn − 1, with a sample standard deviation
| Confidence | Critical value | Margin of error | Lower bound | Upper bound |
|---|
Results are estimates. See the methodology below.
How to use the calculator
- Choose the mode: mean (a measurement such as a score or a weight) or proportion (a share of yes answers).
- Pick the confidence level. 95% is the most common choice.
- Mean mode: enter the sample mean, the standard deviation and n. Keep "sample standard deviation" unless σ is genuinely known from outside the sample.
- Proportion mode: enter the number of successes and the sample size.
- Mean mode shows the bounds, the margin of error, the standard error and, with s, the degrees of freedom. Proportion mode shows the Wilson bounds, the sample proportion, the Wald interval and margin, and the Wilson center. The table repeats the interval at every level; in proportion mode its bounds are Wilson and its margin is Wald.
Formulas used
Mean
Interval = x̄ ± c × s / √n, where s / √n is the standard error. With a sample standard deviation, c is the Student's t critical value with n − 1 degrees of freedom, so you need at least 2 observations. With a known population σ, c is the normal value z, the formula given in the NIST/SEMATECH e-Handbook. The t quantiles are computed numerically and match the NIST t table, for example 2.228 for 10 degrees of freedom at 95%.
Proportion
- Wald: p̂ ± z × √(p̂(1 − p̂) / n), with p̂ = successes / n, clipped at 0% and 100%. NIST calls it the expression most frequently used and notes that its lower limit can be negative.
- Wilson score (the main result): centered on (p̂ + z²/2n) / (1 + z²/n) rather than on p̂. NIST notes that Brown, Cai and DasGupta recommend it, and that Agresti and Coull recommend it for virtually all combinations of n and p.
Confidence interval examples
1. Mean 72.4, s = 9.8, n = 100, 95%
t = 1.9842 (99 degrees of freedom), standard error 0.98, margin ±1.9445, interval 70.4555 to 74.3445. If 9.8 were a known σ, z = 1.959964 gives 70.4792 to 74.3208, slightly narrower.
| Same data, n | t | Interval |
|---|---|---|
| 100 | 1.9842 | 70.4555 to 74.3445 |
| 30 | 2.0452 | 68.7406 to 76.0594 |
| 10 | 2.2622 | 65.3895 to 79.4105 |
| 2 | 12.7062 | −15.6495 to 160.4495 |
At 99% the n = 100 margin grows to ±2.5739; at 80% it shrinks to ±1.2644.
2. 62 successes out of 100, 95%
Wilson: 52.21% to 70.90%, centered at 61.56%, so it is not symmetric around p̂ = 62%. Wald: 52.49% to 71.51%, ±9.51 points.
3. Rare events: 1 out of 20
Wald gives 0% to 14.55% after clipping a negative lower bound. Wilson gives 0.89% to 23.61%. With 0 out of 20, Wald collapses to 0% to 0%, an interval of zero width, while Wilson still gives 0% to 16.11%. These are the textbook reasons to prefer Wilson.
Check against NIST: 26 out of 200 at 90% gives a Wilson lower bound of 9.577%, the 0.09577 in the e-Handbook's example. NIST uses it as a one-sided 95% bound, which takes the same z as a two-sided 90% interval.
What a 95% confidence interval means
The 95% describes the method, not one particular interval. In NIST's words, if the same population were sampled on numerous occasions, the intervals would bracket the true value in approximately 95% of the cases. It does not mean there is a 95% probability that the true mean lies in the interval you just computed: that interval either contains it or it doesn't.
- The margin covers random sampling error only. A biased, non-random or self-selected sample, or one with heavy non-response, can be far off with a narrow interval.
- Not modeled: finite-population correction, one-sided intervals, differences between two means or proportions, exact (Clopper–Pearson) and bootstrap intervals.
Frequently asked questions
Should I use t or z?
Use t whenever the standard deviation comes from your own sample, which is almost always. Use z only when σ is known from outside the data. For proportions the calculator uses z.
Why is my interval so wide?
Small samples, high variability and high confidence all widen it. The margin shrinks with the square root of n, so quadrupling the sample roughly halves it.
What is the margin of error of a poll with 1,000 people?
For 520 yes answers out of 1,000 at 95%, the Wald margin is ±3.10 points and the Wilson interval is 48.90% to 55.08%. That covers sampling error only.
Why are the Wilson and Wald intervals different?
Wald assumes the sampling distribution is symmetric around p̂, which fails near 0% or 100% and with small n. Wilson adjusts the center and width; with large samples and middle-range proportions the two are almost the same.
How many observations do I need for a given margin?
Work it out before collecting data with the sample size calculator, which uses the same normal critical values.
Sources
The calculator assumes a simple random sample and, for means, roughly normal data or a reasonably large sample. It is a teaching and planning aid, not a substitute for a statistician's review of a study design.