Confidence Interval Calculator
Margin of error and the confidence interval for a mean, using the exact t-distribution for small samples and z for large ones, with the critical value shown.
Confidence Interval Calculator: with the default inputs, margin of error is 2.9399.
The average of your sample.
The sample standard deviation — the one spreadsheets call STDEV.S.
How many observations the mean and SD came from.
Half the width of the interval: critical value × standard error.
- Lower bound
- 97.0601
- Upper bound
- 102.9399
- Critical value
- 1.959964t* for small samples, z* for large ones.
- Standard error (s ÷ √n)
- 1.5
- Degrees of freedom
- 99n − 1. Only used when the t-distribution applies.
- Distribution used
- Normal (z), because n = 100 is at least 30
Assumptions
- The sample is a simple random sample from the population.
- The sampling distribution of the mean is approximately normal (guaranteed by the central limit theorem for large n; assumed for small n).
- The standard deviation entered is the sample SD (divisor n − 1), matching Excel's STDEV.S.
- t is used below n = 30 and z at or above it; t critical values come from bisection on the exact t CDF (accurate to ~1e-10).
| Level | Critical value | Margin of error | Lower | Upper |
|---|---|---|---|---|
| 80% | 1.2816 | 1.9223 | 98.0777 | 101.9223 |
| 90% | 1.6449 | 2.4673 | 97.5327 | 102.4673 |
| 95% | 1.96 | 2.9399 | 97.0601 | 102.9399 |
| 98% | 2.3263 | 3.4895 | 96.5105 | 103.4895 |
| 99% | 2.5758 | 3.8637 | 96.1363 | 103.8637 |
| 99.9% | 3.2905 | 4.9358 | 95.0642 | 104.9358 |
More confidence always costs width. Going from 95% to 99% widens the interval by about a third at large n.
How this is worked out
The formula
Standard error: SE = s ÷ √n Margin of error: E = critical value × SE Interval: x̄ − E to x̄ + E Critical value = t*(α/2, n − 1) when n < 30, otherwise z*(α/2) α = 1 − confidence level. For 95%: z* = 1.959964
Open How it’s calculated above to see this worked through with your own numbers.
What you enter
- Sample mean (x̄)
- The average of your sample.defaults to 100
- Standard deviation (s)
- The sample standard deviation — the one spreadsheets call STDEV.S.0 or more · defaults to 15
- Sample size (n)
- How many observations the mean and SD came from.from 2 to 1000000000000 · whole numbers only · defaults to 100
- Confidence level
- Choose one of 4 options.90% · 95% (standard) · 99% · Custom…
- Custom confidence level(under More options)
- Only used when Confidence level is set to Custom.a percentage · from 50 to 99.99 · defaults to 95
What you get back
- Margin of errormain answer
- Half the width of the interval: critical value × standard error.
- Lower bound
- Upper bound
- Critical value
- t* for small samples, z* for large ones.
- Standard error (s ÷ √n)
- Degrees of freedom
- n − 1. Only used when the t-distribution applies.
- Distribution used
What this assumes
- The sample is a simple random sample from the population.
- The sampling distribution of the mean is approximately normal (guaranteed by the central limit theorem for large n; assumed for small n).
- The standard deviation entered is the sample SD (divisor n − 1), matching Excel's STDEV.S.
- t is used below n = 30 and z at or above it; t critical values come from bisection on the exact t CDF (accurate to ~1e-10).
About this calculator
A confidence interval turns a single sample mean into an honest range. A poll that reports "52% ± 3 points" is telling you the margin of error; this calculator produces the same thing for any measured average — test scores, response times, blood pressure, revenue per customer.
What it computes
Three numbers drive everything: your sample mean, the sample standard deviation, and how many observations you have. Divide the SD by √n and you get the standard error — how much the sample mean itself would bounce around if you repeated the study. Multiply that by a critical value from the right distribution and you have the margin of error. The interval is the mean plus and minus that margin.
t or z, and why it matters
When n is small, your standard deviation is itself an estimate, and a noisy one. Student's t-distribution has fatter tails to absorb that extra uncertainty, so it produces a wider — more honest — interval. This calculator uses t whenever n is under 30 and says so in the results, and z otherwise. The gap is dramatic at small n: for 95% confidence, t is 2.776 at n = 5 and 2.262 at n = 10, against z = 1.960. By n = 30 the difference has shrunk to about 2%, which is why 30 is the usual switching point. (There is nothing magic about 30 — using t at every sample size is defensible and slightly conservative.)
The critical values here are computed from the exact t-distribution rather than read off a rounded table, so they match published tables in every printed digit.
How to read the result
"95% confident" is a statement about the procedure, not about this one interval. If you repeated the whole study many times, about 95% of the intervals you built this way would contain the true population mean. It does not mean there is a 95% probability that the true mean lies inside the specific interval you are looking at — that interval either contains it or it doesn't.
Where it misleads
- The formula assumes a random sample. A biased sample gives you a beautifully precise interval around the wrong number, and no amount of extra data fixes that.
- Halving the margin of error takes four times the sample, because the √n is in the denominator. Use the sample-size calculator to plan for a target margin before you collect data.
- For proportions (percentages of yes/no answers) rather than means, the standard error is √(p(1−p)/n) instead — a different formula.
- With n under about 15 and visibly skewed data, neither t nor z is reliable; a bootstrap interval is the better tool.
Frequently asked questions
▸What does a 95% confidence interval actually mean?
That the method produces intervals containing the true mean 95% of the time in repeated sampling. It is a property of the procedure, not a probability attached to the one interval in front of you.
▸When should I use t instead of z?
Use t whenever the standard deviation is estimated from the sample — which is nearly always. The correction matters most below n = 30, which is where this calculator switches automatically.
▸How do I make my confidence interval narrower?
Collect more data (the margin shrinks with √n), reduce the variability in the measurement itself, or accept a lower confidence level. Quadrupling the sample halves the margin.
▸Why does 99% confidence give a wider interval than 95%?
Because to be more certain of catching the true mean you must cast a wider net. The critical value rises from 1.96 to 2.576, so the interval grows by about 31%.
▸Can I use this for a percentage or proportion?
Not directly — proportions have their own standard error, √(p(1−p)/n). Use the sample size calculator for proportion-based planning.
Put this calculator on your own site
A working confidence interval, free for any site, with no ads and no sign-up. It resizes to fit wherever you paste it and updates itself as this page improves.
Paste this anywhere. It works on any site, carries no ads, never expires, and always shows the current version.
Confidence Interval Calculator by CalculateItNow
The page's own title. The clearest description of what the link leads to.
The credit line sits outside the widget on purpose, so it is a real link on your page rather than one buried in a frame. Please keep it — it is what pays for CalculateItNow staying free and ad-free. The script only resizes the widget to fit its contents; drop it and the widget still works.
Browse every calculator widget·How to add it to WordPress, Squarespace or Wix
Related calculators
The questions people ask next to a confidence interval.
How many people to survey for a given margin of error and confidence level, using Cochran's formula with the finite population correction.
Turn a raw value into a z-score, percentile and p-value using the exact normal distribution, with the standard z-table and the arithmetic shown.
Population or sample standard deviation, variance, mean and standard error for up to 10 values — with the full deviation table so you can see every step.
Pearson's r, r-squared, covariance and the line of best fit for up to 10 (x, y) pairs, with the deviation table and a plain reading of how strong the link is.
Find the mean, median, mode, sum and range of up to 10 numbers, with the work shown and a deviation table that explains what the mean really is.
Turn a z, t or chi-square statistic into a p-value, one- or two-tailed, with the critical value at your alpha and a plain-English verdict on what it means.