Calcamaze

Confidence Interval Calculator

Calculate a confidence interval for a mean from the sample mean, standard deviation and sample size, using the t or z distribution.

Result

95% confidence interval
46.6978 to 53.3022
Margin of error
± 3.3022
Standard error
1.6
σ ÷ √n
Critical t value (df = 24)
2.0639

Find the range that is likely to contain the true population mean. Enter the mean, standard deviation and size of your sample and choose a confidence level; the calculator gives the interval, the margin of error and the critical value it used.

What is a confidence interval?

A confidence interval is a range of values, worked out from a sample, that is likely to contain an unknown population value such as the mean. It is written as an estimate plus or minus a margin of error — for example, an average delivery time of 50 ± 3.3 minutes at 95% confidence.

The width depends on three things: how variable the data are (the standard deviation), how much data you have (the sample size) and how confident you want to be. The standard error s ÷ √n is multiplied by a critical value from Student’s t distribution, which allows for the extra uncertainty of estimating the standard deviation from a small sample. As n grows, t approaches the normal z value.

How to use the confidence interval calculator

  1. Enter your sample mean, sample standard deviation and sample size.
  2. Choose a confidence level, usually 95%.
  3. Read the interval and the margin of error either side of the mean.

Formula

CI = x̄ ± t* × s ÷ √n

x̄ is the sample mean, s the sample standard deviation, n the sample size and t* the critical value of Student’s t distribution with n − 1 degrees of freedom.

When the population standard deviation σ is known, the critical z value is used instead (1.96 for 95%).

Worked examples

Average delivery time from 25 orders

Sample mean (x̄)
50
Standard deviation
8
Sample size (n)
25
Confidence level
95%
The standard deviation is…
From the sample (use t)
95% confidence interval
46.6978 to 53.3022
Margin of error
± 3.3022
Standard error
1.6

The standard error is 8 ÷ √25 = 1.6. With 24 degrees of freedom t* = 2.0639, so the margin is 2.0639 × 1.6 = 3.302 and the interval is 46.698 to 53.302 minutes.

IQ scores with a known σ

Sample mean (x̄)
100
Standard deviation
15
Sample size (n)
36
Confidence level
95%
The standard deviation is…
Known for the population (use z)
95% confidence interval
95.1001 to 104.8999
Margin of error
± 4.8999
Standard error
2.5

σ = 15 is known, so use z = 1.96: 100 ± 1.96 × 15 ÷ √36 = 100 ± 4.9, giving 95.1 to 104.9.

Two-sided critical values

Confidencezt (df = 5)t (df = 10)t (df = 30)
80%1.2821.4761.3721.31
90%1.6452.0151.8121.697
95%1.962.5712.2282.042
98%2.3263.3652.7642.457
99%2.5764.0323.1692.75

Margin of error for a percentage

Polls report proportions rather than means, but the idea is the same: p̂ ± z × √(p̂(1 − p̂) ÷ n). If 52% of 1,000 people say yes, the 95% margin of error is 1.96 × √(0.52 × 0.48 ÷ 1,000) = 3.1 percentage points, so the interval runs from about 48.9% to 55.1%. That includes 50%, so the poll cannot say a majority agrees.

Common mistakes

  • Using z instead of t with a small sample and a sample standard deviation, which makes the interval too narrow.
  • Dividing the standard deviation by n instead of √n when finding the standard error.
  • Reading the interval as the range that contains 95% of individual values — it describes the mean, not single observations.

Frequently asked questions

What does a 95% confidence interval mean?

If you repeated the sampling many times, about 95% of the intervals built this way would contain the true mean. It doesn’t mean there is a 95% chance this particular interval contains it.

Should I use t or z?

Use t when the standard deviation comes from your sample, which is almost always. Use z only when the population standard deviation is genuinely known. For large samples the two give nearly the same answer.

How do I make the interval narrower?

Collect a larger sample or accept a lower confidence level. Quadrupling the sample size roughly halves the margin of error.

If two confidence intervals overlap, is there no real difference?

Not necessarily. Two 95% intervals that don’t overlap do point to a significant difference, but intervals can overlap a little while the difference is still significant. Test the difference directly, or build an interval for it.

Sources

  1. Confidence limits for the mean (NIST/SEMATECH e-Handbook of Statistical Methods), National Institute of Standards and Technology (NIST)
  2. Introductory Statistics 2e, Chapter 8: Confidence Intervals, OpenStax, Rice University

Last updated · Calculations checked by automated tests· Editorial policy