Skip to content
ihateDesmos

Confidence interval calculator

Type the sample mean, standard deviation and sample size, choose a confidence level, and get the interval with its margin of error, standard error and critical value.

95% confidence interval
69.7255 to 75.2745
Margin of error
± 2.77448
Standard error
1.36667
Critical value, t* (35 degrees of freedom)
2.03011
Steps
  1. Standard error: 8.2 ÷ √36 = 1.36667
  2. Critical value for 95% confidence: t* (35 degrees of freedom) = 2.03011
  3. Margin of error: 2.03011 × 1.36667 = 2.77448
  4. Interval: 72.5 ± 2.77448, which is 69.7255 to 75.2745

Read it as: if you repeated this sampling many times, about 95% of intervals built this way would contain the true mean. It doesn’t mean 95% of the data falls inside.

How to use it

  1. 1
    Type the sample mean, standard deviation and sample size.
  2. 2
    Choose the confidence level. 95% is the most common.
  3. 3
    Say whether the standard deviation came from your sample (uses t) or is known for the whole population (uses z). In practice it almost always comes from the sample.

The formula

A confidence interval for a mean is mean ± critical value × standard error, where the standard error is the standard deviation divided by √n.

The critical value depends on the level. For z these are 1.645 for 90%, 1.960 for 95% and 2.576 for 99%. For t they are slightly larger, by an amount that depends on the sample size, which accounts for the extra uncertainty of estimating the standard deviation.

A worked example

A sample of 36 has mean 72.5 and standard deviation 8.2. The standard error is 8.2 ÷ √36 ≈ 1.367. With 35 degrees of freedom, the 95% critical value is t* ≈ 2.030, so the margin of error is about 2.775. The interval runs from about 69.73 to 75.27.

What the interval means

A 95% interval means the method captures the true mean 95% of the time across repeated samples. Any one interval either contains the true mean or doesn’t; the 95% describes the procedure, not this particular result.

It is also not a range holding 95% of the data. With a large sample, the interval becomes very narrow even though the data stays just as spread out.

What makes an interval narrower

Three things control the width: more data (a larger n, though quadrupling n only halves the width), less variable data, and a lower confidence level. A 99% interval is wider than a 95% one from the same data, because being more sure requires a wider net.

Frequently asked questions

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 truly known. With large samples the two give nearly the same answer.
What is the margin of error?
It is the ± part of the interval: the critical value times the standard error. It is half the width of the interval.
Why is 95% so common?
It is a convention that balances precision and certainty. It corresponds to about ±2 standard errors and to the common 5% significance level.
Does this work for proportions?
This calculator is for means. For a proportion p̂ from n trials, the usual interval is p̂ ± z* × √(p̂(1 − p̂) ÷ n).

Related tools and guides

Try the confidence interval calculator

It opens instantly, with no account and nothing to install.

Open the calculator