Confidence Interval Calculator

Calculate a confidence interval for a mean (t or z) or a proportion, with the margin of error and critical value, and watch what the confidence level really means with simulated samples.

Answer

95% confidence interval for the mean

45.8722 to 54.1278

Margin of error± 4.1278
Critical valuet = 2.0639 (df 24)
Standard error2

Your interval

45.87254.128estimate 50 ± 4.128

What “95% confident” means

true mean 5025 of 25 caught it (100%)New samples ↻50%80%90%95%99%

25 imaginary samples of 25 from a population whose true mean is 50. Each bar is that sample’s interval; red bars miss. In the long run about 95% catch the true mean. Drag the red handle to change the confidence level.

Why this answer

  1. Standard error. s ÷ √n = 10 ÷ √25 = 2: how much sample means typically vary.
  2. Critical value. t with 24 degrees of freedom for 95% = 2.0639 (a bit wider than z = 1.96 because s is itself an estimate).
  3. Margin of error. 2.0639 × 2 = 4.1278.
  4. Interval. 50 ± 4.1278 = 45.8722 to 54.1278.

Why it works

What does 95% confident mean?

true mean 5025 of 25 caught it (100%)New samples ↻50%80%90%95%99%

Step 1 of 3

Catching the true mean

We know the truth here: the population mean is 50. Each bar is one random sample’s interval. Drag the red handle down toward 50% and count the red misses, then back up to 99%. Tap “New samples” to draw again.
Visit 50%, then set 99%.

Put it to use

Reading polls and studies

A poll of 1,000 people showing 52% support with a ±3.1 point margin means the true share is plausibly anywhere from about 49% to 55%: too close to call. To halve a margin of error you need four times the sample. The interval only covers random sampling error, not biased questions or who chose to answer.

How it works

The confidence interval calculator gives a range of plausible values for a population mean or proportion from a sample, at a chosen confidence level such as 90%, 95% or 99.

For a mean with an unknown population standard deviation it uses Student's t: x̄ ± t × s/√n with n − 1 degrees of freedom. When σ is known it uses z instead. For a proportion it uses p̂ ± z × √(p̂(1 − p̂)/n).

A 95% confidence level means that if you repeated the sampling many times, about 95% of the intervals built this way would contain the true value.

Mean: x̄ ± t* × s ÷ √nKnown σ: x̄ ± z* × σ ÷ √nProportion: p̂ ± z* × √(p̂(1 − p̂) ÷ n)z* = 1.645 (90%), 1.960 (95%), 2.576 (99%)

Worked example: x̄ = 50, s = 10, n = 25, 95%

  1. Standard error: 10 ÷ √25 = 2.
  2. t with 24 degrees of freedom: 2.064.
  3. Margin: 2.064 × 2 = 4.13.
  4. Interval: 45.87 to 54.13.

Common mistakes

  • Using z instead of t for small samples with an estimated standard deviation.
  • Saying there's a 95% probability the true value is in this particular interval.
  • Using the standard deviation instead of the standard error.
  • Ignoring bias: the interval covers random sampling error only.

Frequently asked questions

How do you calculate a 95% confidence interval?

Take the estimate plus or minus the critical value times the standard error: for a mean, x̄ ± t* × s/√n; for large samples t* is close to 1.96.

What is the margin of error?

Half the width of the confidence interval: the critical value times the standard error.

When do I use t instead of z?

Use t when the population standard deviation is unknown and estimated from the sample, which is almost always.

How does sample size affect the interval?

The margin shrinks with the square root of n: four times the sample halves the margin of error.

What is the margin of error for a poll of 1,000 people?

About ±3.1 percentage points at 95% confidence when the result is near 50%.