Confidence Interval Calculator mean
Compute a confidence interval for a mean from the sample mean, standard deviation and size.
Show working (LaTeX)
Uses the z (large-sample) interval. For small n with unknown σ, a t-interval is more accurate.
This free confidence interval calculator builds a confidence interval for a population mean from the sample mean, standard deviation, sample size and confidence level — with the margin of error shown.
How to use the confidence interval calculator
Enter the sample mean, standard deviation and size, pick a confidence level, and press Calculate. The confidence interval calculator returns the interval, the margin of error and the critical value. As a margin of error calculator and a 95 confidence interval calculator, it covers the most common cases instantly.

What is a confidence interval?
A confidence interval is a range that is likely to contain the true population mean, with a stated level of confidence. See the confidence interval reference for details.
Confidence interval formula
$$\bar{x}\pm z^{*}\cdot\frac{\sigma}{\sqrt{n}}$$where $z^{*}$ is the critical value (1.96 for 95%) and $\sigma/\sqrt{n}$ is the standard error.
How to build a confidence interval step by step
- Find the sample mean and standard deviation.
- Pick a confidence level and its critical value z*.
- Add and subtract the margin of error $z^{*}\sigma/\sqrt{n}$.
Worked example
With mean 50, SD 8, n = 30 and 95% confidence, the margin of error is $1.96\times 8/\sqrt{30}\approx 2.86$, so the interval is about [47.14, 52.86].
Why confidence intervals matter in machine learning
In machine learning for beginners, confidence intervals quantify the uncertainty of a metric — for example reporting accuracy as 0.85 ± 0.03 across cross-validation folds. They build on the standard deviation and the z-score.
🤖 ML insight
Reporting a model metric with a confidence interval is far more honest than a single number — it tells readers how much the score might move on new data.
Frequently asked questions
What does this confidence interval calculator need?
What is the margin of error?
What z value is used for 95%?
Should I use z or t?
Is the confidence interval calculator free?
What affects the width
Three things control how wide the range is. A higher confidence level (99% versus 90%) widens it, because you demand more certainty. A larger sample size narrows it, since the standard error shrinks with the square root of n. And more variable data — a bigger standard deviation — widens it.
A common misreading is “there is a 95% chance the true mean is inside this range.” The true mean is fixed; it is the range that is random. The honest phrasing is that 95% of the ranges built this way would capture the true mean over many repeated samples.
Confidence interval calculator: summary
This confidence interval calculator turns a sample into a clear range for the mean. Pair it with the standard deviation calculator and the p value calculator.