Home / Math / Confidence Interval Calculator

Confidence Interval Calculator for a Mean or a Proportion

Turn a sample result into an interval estimate. Enter a sample mean, standard deviation and size, or a count of successes, and get the margin of error and the interval at your chosen confidence level.

By Adzita Editorial Team · Updated 2026-11-03 · How we build and check our tools

Sample standard deviation s, or the known population σ if you choose z.

What a confidence interval does and does not say

A confidence interval is a range built from sample data that is designed to capture an unknown population value. A 95% level refers to the method: if you repeated the sampling many times and built an interval each time, about 95% of those intervals would contain the true value. It does not mean there is a 95% probability that this particular interval holds the true value, because once calculated, the interval either contains it or it does not. A wider interval comes from higher confidence, a more variable sample or a smaller sample size. Quadrupling the sample size roughly halves the margin of error, since the standard error shrinks with √n.

Interval for a mean: z or t

The interval for a mean is x̄ ± critical value × s ÷ √n. The term s ÷ √n is the standard error. When the population standard deviation is known, the critical value comes from the normal distribution: 1.960 for 95%. In nearly all real work σ is unknown and estimated from the sample, which adds uncertainty, so the t-distribution with n − 1 degrees of freedom is used. It has heavier tails, so its critical values are larger, especially for small samples.

Degrees of freedomt for 95%
52.571
102.228
202.086
302.042
Very large1.960

The calculator holds a table of t values for 1 to 30 degrees of freedom and for 40, 50, 60, 80, 100 and 120. For other values it uses the row just below, which gives a slightly wider and therefore cautious interval. Above 120 it uses the normal value.

Interval for a proportion: Wald and Wilson

For a sample proportion p̂ = successes ÷ n, the traditional Wald interval is p̂ ± z × √(p̂(1 − p̂) ÷ n). It is simple but can perform poorly with small samples or proportions near 0 or 1, and it can spill outside the 0 to 100% range. The Wilson score interval recentres the estimate and gives better coverage, so it is shown as the headline. As a rule of thumb, the Wald interval is acceptable when both the successes and the failures number at least 10. Both are displayed, and the page warns you when the Wald assumptions look weak.

Common mistakes and limits

For choosing n in advance, see the sample size calculator.

Worked example

A sample of 10 measurements has a mean of 100 and a sample standard deviation of 5. Find the 95% confidence interval for the true mean.

Inputs

Interval for aMean
Confidence level95%
Sample mean100
Standard deviation5
Uset-distribution (σ unknown, estimated by s)
Sample size n10

Result

96.4235 to 103.5765

95% confidence interval for the mean, margin of error ±3.5765.

Standard error s ÷ √n1.58114
t critical value, df = 92.262
Margin of error3.5765
Lower bound96.4235
Upper bound103.5765

Accuracy note: Results use standard double-precision arithmetic, so very large or very small values may be rounded. Check important results by another method.

Frequently asked questions

How do I calculate a 95% confidence interval for a mean?

Find the standard error by dividing the standard deviation by the square root of n, multiply it by the t critical value for n minus 1 degrees of freedom, then add and subtract the product from the mean.

When should I use z instead of t?

Use z when the population standard deviation is known in advance, which is rare. Otherwise use t, which accounts for the extra uncertainty from estimating the spread from the sample itself.

What does a 95% confidence level really mean?

It means the procedure captures the true value in about 95% of repeated samples. It is a statement about the method, not a 95% chance for one computed interval.

How can I get a narrower interval?

Increase the sample size, reduce variability through better measurement, or accept a lower confidence level. Halving the margin of error needs about four times as many observations.

Why does the page show Wilson and Wald intervals?

The Wald interval is the textbook formula but can misbehave for small samples or extreme proportions. The Wilson interval keeps its coverage closer to the stated level in those cases.

Z-Score CalculatorZ-score, percentile, tail probabilities and two-tailed p-value from the standard normal curve.Sample Size CalculatorHow many people to survey for a chosen confidence level and margin of error (Cochran).Standard Deviation CalculatorPopulation and sample standard deviation, variance, mean, sum, count and standard error for a list of numbers.Probability CalculatorSingle-event odds, two-event and/or rules, and exact binomial probabilities with working.

References and sources

  1. NIST/SEMATECH e-Handbook of Statistical Methods: confidence intervals and the t distribution. Link
  2. Wilson, E. B. (1927), Probable inference, the law of succession, and statistical inference, Journal of the American Statistical Association.

Check primary sources for anything you rely on.