Skip to content
Statistics CalculatorStatistics Calculator

Confidence Interval Calculator

Compute a confidence interval for a population mean from raw data or summary statistics. Choose your confidence level and whether the population standard deviation is known, and see the interval on a number line.

Tested against reference valuesLast reviewed August 2026
95% confidence interval

[19.8111, 22.9889]

Margin of error1.5889
Sample mean
21.4000
Std. error
0.7024
Critical (t)
2.2622
df
9

Interval

t, df = 9
= 21.4019.8122.99
Point estimate with the confidence interval as an error bar.

How to use this calculator

  1. Enter your raw data, or switch to “Summary stats” to type the mean, standard deviation, and sample size.
  2. Choose a confidence level (90%, 95%, or 99%).
  3. Say whether the population standard deviation is known — this decides whether the z- or t-distribution is used.
  4. Read the interval, the margin of error, and the critical value, shown on a number line.

What is a confidence interval?

A confidence interval is a range of plausible values for a population parameter, estimated from sample data. A 95% confidence interval means that if you repeated the sampling many times, about 95% of the intervals you build would contain the true population mean.

The confidence level describes the long-run reliability of the method, not the probability that a single interval contains the mean.

Confidence interval formula

A confidence interval for a mean is the point estimate plus or minus a margin of error:

xˉ±tα/2,n1sn\bar{x} \pm t_{\alpha/2,\,n-1}\cdot\dfrac{s}{\sqrt{n}}

When the population standard deviation σ is known, the t critical value is replaced by the z critical value and s by σ.

When to use z vs. t

SituationUseCritical value
Population σ knownz (normal)z at α/2
Population σ unknownt (Student’s)t at α/2, n−1

In most real analyses the population standard deviation is unknown, so the t-distribution is the default. For large samples the two give nearly the same interval.

Confidence interval in Excel

The margin of error is =CONFIDENCE.T(alpha, standard_dev, size) for the t-based interval, or =CONFIDENCE.NORM(alpha, standard_dev, size) when σ is known. Add and subtract it from the mean to get the interval bounds. For a 95% interval, alpha is 0.05.

Frequently asked questions

What does a 95% confidence interval mean?

It means the method used to build the interval would capture the true population mean about 95% of the time across many repeated samples. It does not mean there is a 95% probability that this particular interval contains the mean.

Should I use the z or t distribution?

Use the t-distribution when the population standard deviation is unknown and estimated from the sample, which is the usual case. Use the z-distribution only when the population standard deviation is known.

What is the margin of error?

The margin of error is the critical value times the standard error. It is the half-width of the confidence interval — the amount added to and subtracted from the sample mean.

How does the confidence level affect the interval width?

A higher confidence level (e.g. 99% instead of 95%) uses a larger critical value, which produces a wider interval. Increasing the sample size, on the other hand, narrows the interval.

Related calculators

Was this calculator helpful?