01
How to calculate a confidence interval
- Choose what you have: a list of measurements, summary statistics, or a count of “yes” outcomes.
- Enter the numbers and pick the confidence level.
- Read the interval and copy the formatted line into your results.
02
Confidence interval for a mean
mean ± t × s ÷ √n
t = critical value of the t distribution on n − 1 degrees of freedom
Example: eight measurements with mean 5 and SD 2.14. The standard error is 2.14 ÷ √8 = 0.756 and t for 95% on 7 degrees of freedom is 2.365, so the interval is 5 ± 1.79: from 3.21 to 6.79.
| n | t for 95% | Compared with z = 1.96 |
|---|---|---|
| 5 | 2.776 | 42% wider |
| 10 | 2.262 | 15% wider |
| 30 | 2.045 | 4% wider |
| 100 | 1.984 | 1% wider |
Using 1.96 for a small sample makes the interval too narrow. The calculator always uses t for means.
03
Confidence interval for a proportion
For a count x out of n, the calculator uses the Wilson score interval (Wilson, 1927), with p̂ = x ÷ n:
centre = (p̂ + z²/2n) ÷ (1 + z²/n)
half-width = z × √( p̂(1 − p̂)/n + z²/4n² ) ÷ (1 + z²/n)
Example: 15 of 50 (30%) gives a 95% interval of 19.1% to 43.8%. The simpler “Wald” formula p̂ ± z√(p̂(1 − p̂)/n) gives 17.3% to 42.7% here, and can produce limits below 0% or above 100% when the proportion is near either end or the sample is small. Wilson’s interval stays within 0 to 100% and is not centred on p̂.
04
What a 95% confidence interval means
If you repeated the study many times and computed an interval each time, about 95% of those intervals would contain the true value. It is a statement about the method, not a 95% probability that the true value lies in this particular interval.
A narrow interval means a precise estimate. Larger samples and less variable data narrow it; asking for 99% instead of 95% widens it.
05
Confidence interval, SD and SEM
The standard deviation describes the spread of individual values. The standard error and the confidence interval describe the precision of the mean. Error bars can show any of the three, so always say which. The standard deviation calculator reports all of them from one list of numbers.
06
Common mistakes with confidence intervals
- Using 1.96 for a small sample. For the eight values in the example, 1.96 gives a margin of 1.48 instead of 1.79, an interval 17% too narrow.
- Using the SD where the standard error belongs. 5 ± 2.365 × 2.14 runs from −0.06 to 10.06: that range describes individual values, not the mean.
- The Wald formula for a rare outcome. For 1 out of 20 it gives −4.6% to 14.6%; Wilson’s interval is 0.9% to 23.6%.
- Reading overlapping intervals as “no difference”. Means of 10 and 13, each with a standard error of 1, have 95% intervals of 8.04 to 11.96 and 11.04 to 14.96, which overlap, yet the difference is significant: z = 2.12, p = .034.
Trust
How this page is checked
- The calculation runs on code with automated tests against worked reference values. Every number in the examples on this page was produced by that same code, not typed by hand.
- The formulas and conventions used are stated on the page, so you can reproduce the result yourself or compare it with your own software.
- Last reviewed by the Sciloom team, Zebra Nine Studio Inc. It is a tool for research and teaching, not a substitute for a statistician, a validated lab method or medical advice.
Cite this page
Sciloom. (2026). Confidence interval calculator. Zebra Nine Studio Inc. https://sciloom.si/confidence-interval-calculator
Frequently asked questions
How do I calculate a 95% confidence interval?
For a mean: take the mean plus and minus the t critical value times the standard error (SD ÷ √n). The calculator does this from raw data or from the mean, SD and n.
When do I use t instead of z?
Use t whenever the standard deviation is estimated from the sample, which is nearly always. The two agree for large samples; for small ones z gives an interval that is too narrow.
What is the margin of error?
Half the width of the confidence interval: the amount added to and subtracted from the estimate.
Why is the proportion interval not symmetric?
The Wilson interval is pulled slightly toward 50%, which keeps it inside 0 to 100% and makes it more accurate for small samples and extreme proportions.