Skip to content
Calcapedia
Statistics & Data

Confidence Interval Calculator

Turn your sample results into a range of believable values for the true average or share, at 90%, 95%, 99% or any other level.

Level: Grade 12 to college

  • Common Core standard HSS.IC.B.4Use data from a sample survey to estimate a population mean or proportion; develop a margin of error through the use of simulation models for random sampling.
Printable worksheet

Confidence Interval Calculator

Inputs
Interval for
The standard deviation is
Confidence level

Result

95% confidence interval

45.8722 to 54.1278

The 95% confidence interval for the population mean runs from 45.8722 to 54.1278.

Lower bound
45.8722
Upper bound
54.1278
Margin of error
4.1278
Standard error
2
Critical value (t*, 24 df)
2.0639

See the step-by-step solution ↓

Step-by-step solution

  1. The standard deviation comes from the sample, so use the t distribution with n − 1 = 24 degrees of freedom. Its critical value for 95% confidence is

    t*=2.0639
  2. Find the standard error: the standard deviation divided by the square root of the sample size. It shows how much the average would vary between samples

    SE=1025=2
  3. Multiply the critical value by the standard error to get the margin of error, how far the interval reaches each way

    E=2.0639×2=4.127797
  4. Subtract and add the margin to the sample mean to get the interval

    CI=50 ± 4.127797=45.8722 to 54.1278

Test yourself

20 quick questions built from this calculator's formula: work out results, predict what happens when an input changes, and work backward from an answer. Every answer comes with the working.

What this calculator does

See how far your sample's answer might be from the truth, as a range of believable values. A sample gives you one estimate, but a different sample would give a slightly different one. A confidence interval turns that one estimate into a range for the whole population, the full group you're studying. Its width shows how much your estimate would bounce around from one sample to the next.

It works for a mean (an average of measurements) or a proportion (the share who answered yes). For a mean, you enter the sample's average, its standard deviation (how spread out the values are) and the sample size. For a proportion, you enter how many successes you counted in the sample. You get a two-sided interval, with both a low end and a high end. Pick 90%, 95% or 99% confidence, or type any level between 50% and 99.99%.

Where it's used

Why this math matters outside the classroom:

  • Election polls. A poll in which 52% of 1,000 voters favor a candidate gives a 95% interval of about 48.9% to 55.1%.
  • Battery testing. A maker testing 36 batteries with mean life 500 hours and SD 30 reports 500 ± 10.2 hours at 95% confidence.
  • Fish surveys. Biologists who measure 50 fish averaging 32 cm with SD 4 cm report a 95% interval of about 30.9 to 33.1 cm.
  • Customer surveys. A café that finds 120 of 400 customers want oat milk estimates the true share at 30% ± 4.5 points with 95% confidence.
  • Class projects. Statistics students sample 40 classmates' nightly sleep and report an interval for the school's mean, not a single number.

Grade level and standards: Grade 12 to college; Common Core State Standards for Mathematics HSS.IC.B.4. © Copyright 2010. National Governors Association Center for Best Practices and Council of Chief State School Officers. All rights reserved.

How to use it

  1. Choose whether you're estimating a mean (an average of measurements) or a proportion (a share of yes answers or successes).
  2. For a mean, enter the sample mean, standard deviation and sample size. Then say where the standard deviation came from: the sample itself, or a known value for the whole population.
  3. For a proportion, enter the number of successes and the sample size. Then pick the Wald or Wilson method.
  4. Choose the confidence level and read your interval. You'll also see the margin of error, the standard error and the critical value the calculator used.

What the inputs mean

The standard deviation is
Almost always, the standard deviation is worked out from the same sample. Then the right tool is the t distribution, with n − 1 degrees of freedom (your sample size minus one). Choose the known-population option only when the spread is truly known ahead of time. One example is a measuring process that has been checked and calibrated for a long time.
Successes (x)
How many people or items in your sample have the trait you're measuring, such as the number who answered yes.
Method
Wald is the familiar textbook formula, p̂ ± z·√(p̂(1 − p̂)/n), where p̂ is your sample's share. Wilson is a refinement that works much better for small samples or shares near 0% or 100%. It never gives impossible bounds.
Custom confidence level
Any level from 50% to 99.99%. The more confident you want to be, the wider the interval gets.

Formula and method

Mean, SD from the sample:  x̄ ± t* × s / √n,  with t* from the t distribution with n − 1 df
Mean, population SD known:  x̄ ± z* × σ / √n
Proportion, Wald:  p̂ ± z* × √(p̂(1 − p̂) / n)
Proportion, Wilson:  [p̂ + z*²/(2n)] / (1 + z*²/n)  ±  z* / (1 + z*²/n) × √(p̂(1 − p̂)/n + z*²/(4n²))
Critical value:  the (1 − α/2) quantile, where α = 1 − confidence level

In the formulas, x̄ is the sample mean and n is the sample size. s is the sample's standard deviation, and σ (sigma) is a standard deviation already known for the whole population. p̂ (p-hat) is the share of successes in your sample. t* and z* are critical values, and df means degrees of freedom, which is n − 1 here.

Every interval here has the same shape: your estimate, plus or minus a critical value times a standard error. The standard error measures how much the estimate would change from one sample to another. The critical value sets how many standard errors wide the interval must be to reach your chosen confidence.

α (alpha) is 1 minus the confidence level, so 0.05 for 95%. The critical value is the (1 − α/2) quantile. That's the point on the curve that leaves α/2, half of the leftover chance, beyond each end.

When the standard deviation comes from the sample, it's uncertain too. So the calculator uses the t distribution instead of the normal (bell-curve) one. Its critical values are larger for small samples: 2.064 at 95% with 24 degrees of freedom, against 1.960 for z. They shrink toward the z value as n grows.

For proportions, the standard error depends on p̂ itself. The Wilson interval works backward to find the range of true shares that would fit the result you saw. That nudges its center slightly toward one half.

Worked example

A sample of 25 parts has a mean length of 50 mm and a sample standard deviation of 10 mm. What is the 95% confidence interval for the mean length of all parts?

  1. The standard deviation comes from the sample, so use t with 25 − 1 = 24 degrees of freedom. The 95% critical value is t* ≈ 2.0639.
  2. Standard error, how much the average would vary between samples: 10 ÷ √25 = 2.
  3. Margin of error, how far the interval reaches on each side: 2.0639 × 2 ≈ 4.1278.
  4. Interval: 50 ± 4.1278, which runs from 45.8722 to 54.1278.
  5. For a proportion, 54 yes answers out of 120 give p̂ = 0.45, a standard error of about 0.0454 and a 95% Wald interval of 0.361 to 0.539.

Result: The 95% confidence interval for the mean is 45.8722 to 54.1278 mm.

Understanding the result

The confidence level describes the method, not this one interval. Imagine repeating the sampling many times and building a 95% interval each time. About 95% of those intervals would contain the true population value. Any single interval either contains it or doesn't.

A narrower interval means a more precise estimate. One way to narrow it is a bigger sample. The width shrinks with √n, the square root of the sample size, so four times the sample halves the width. The other way is to accept a lower confidence level.

If two groups' intervals overlap a little, that alone doesn't prove their means are equal. To answer that question, use a direct test of the difference between them.

Assumptions and limitations

  • The sample is random, and each observation is independent of the others.
  • For a mean, the population is roughly normal (bell-shaped), or the sample is big enough for the sample mean to act that way. That often means n of 30 or more, and more if the data are strongly lopsided (skewed).
  • For a Wald proportion interval, you have at least about 10 successes and 10 failures. The calculator warns you when you have fewer.
  • The sample is a small part of the whole population. So no finite population correction, an adjustment for sampling a big share of a group, is applied.
  • The interval covers only random sampling error: the luck of which people or items you happened to pick. It doesn't reflect bias at all. Bias can come from a non-random sample, people who didn't respond, or poorly worded questions.
  • It gives only two-sided intervals. One-sided bounds use a different critical value.
  • The Wald interval can be badly off for small samples or extreme shares. The calculator refuses it when there are zero successes or zero failures, and the Wilson option handles those cases.
  • It doesn't cover intervals for a difference between two means or two proportions.

Frequently asked questions

Does a 95% confidence interval mean there is a 95% chance the true value is inside it?

Not quite. The true value is fixed, so a particular interval either contains it or doesn't. The 95% describes how often the method works in the long run. About 95 of every 100 intervals built this way capture the true value.

When should I use t instead of z?

Use t whenever you estimated the standard deviation from your sample, which is nearly always. Use z only when you truly know the population's standard deviation. With large samples, the two give almost the same answer.

Why is the 99% interval wider than the 95% interval?

To be more sure of catching the true value, you need a wider net. The critical z value rises from about 1.960 to 2.576, so the interval gets roughly a third wider.

Which proportion method should I pick?

Wilson is the safer default, and many statisticians recommend it, especially for small samples or shares near 0 or 1. Wald matches the formula taught in most intro courses. It's fine when you have plenty of successes and failures.

How this calculator is checked

Method: Standard large-sample and Student t confidence intervals for a mean, and the Wald and Wilson score intervals for a binomial proportion, as given in introductory statistics texts. Critical values come from the shared normal and t quantile functions. The calculation is covered by automated tests with known reference values and edge cases. Last updated 2026-10-18. Found a problem? Tell us.

Embed this calculator

Put this Confidence Interval Calculator on your own website or blog for free. Paste this code where you want it to appear: