CalcThis CalcThis
For a mean, proportion or count · 90, 95 or 99% · live curve

Confidence Interval Calculator

Type your sample mean, standard deviation and sample size (or a list of numbers, a number of yes answers, or a count) and get the confidence interval with the margin of error and a picture of it. A mean of 22.8 with a standard deviation of 2.7 from 100 people gives a 95% interval of 22.26 to 23.34. Choose 90%, 95% or 99%, see how much more data would narrow it, and what sample size you need for a margin of error you want.

Your sample

What do you want an interval for?
I have

Confidence interval
—
Type your sample to see the confidence interval.
Confidence interval
—

How to use the confidence interval calculator

Choose what you want an interval for: an average (type the sample mean, standard deviation and sample size, or paste a list of numbers), a proportion (the number of yes answers and the sample size) or a count (the number you counted). Leave the confidence level empty for 95%, type your own, or tap 90% or 99%.

The result gives the interval, the margin of error, the critical value used and every step. The picture shows the curve of the estimate with your interval shaded, the same interval at 90, 95 and 99%, and what 4 times as much data would give. Go advanced to compare two groups, give a standard error instead of a standard deviation, set the level from a z-score or p-value, pick a proportion method, or find the sample size for a margin of error you want.

The formulas

interval = estimate ± critical value × standard error MEAN: x̄ ± t × s ÷ √n · PROPORTION: p̂ ± z × √(p̂(1 − p̂) ÷ n)

The critical value comes from the t distribution (n − 1 degrees of freedom) when the standard deviation is from a sample, or the normal z distribution when the population standard deviation is known. Worked out with this calculator: a mean of 22.8, s = 2.7, n = 100 gives a standard error of 0.2700, t = 1.9842, a margin of error of 0.5357 and a 95% interval of 22.26 to 23.34; with z = 1.9600 the margin is 0.5292.

z critical values by confidence level

Confidence levelz critical value
80%1.282
85%1.440
90%1.645
95%1.960
98%2.326
99%2.576
99.9%3.291

t critical values

With a small sample the t value is larger than z, which widens the interval.

Degrees of freedom90%95%99%
22.9204.3039.925
52.0152.5714.032
101.8122.2283.169
201.7252.0862.845
301.6972.0422.750
601.6712.0002.660
1201.6581.9802.617
z (infinite)1.6451.9602.576

Three proportion methods

The normal approximation (Wald) is the textbook formula but is too narrow for small samples and proportions near 0% or 100%. Wilson score and the exact Clopper-Pearson interval do better. For 40 yes out of 100:

Method (40 yes out of 100, 95%)Interval
Normal approximation (Wald)30.4% to 49.6%
Wilson score30.9% to 49.8%
Exact (Clopper-Pearson)30.3% to 50.3%

For a small sample the normal approximation can fail outright:

Method (3 yes out of 40, 95%)Interval
Normal approximation (Wald)0.0% to 15.7%
Wilson score2.6% to 19.9%
Exact (Clopper-Pearson)1.6% to 20.4%

How wide should the interval be?

The margin of error shrinks with the square root of the sample size: four times as many people halves it. The “What more data would give you” table shows 2, 4 and 10 times your sample, and Go advanced finds the sample size for a margin you pick: ±3 percentage points at 95% needs 1,068 people in the worst case, ±5 points needs 385.

Worked example

A sample of 50 measurements has a mean of 20.6 and a standard deviation of 3.2. The standard error is 0.4525, the 95% critical value is t = 2.0096 (49 degrees of freedom), the margin of error is 0.9094, and the interval is 19.69 to 21.51. At 90% it is 19.84 to 21.36; at 99% it is 19.39 to 21.81.

Related tools

To test a result against a hypothesis use the p-value calculator; for the spread of your data the standard deviation calculator; to average a list the average calculator; and for percentages the percentage calculator.

Sources

  • The mean interval x̄ ± critical value × s/√n, the 95% z value 1.960 and the z table by level are the ones shown by calculator.net's and Omnicalculator's confidence interval calculators; the proportion interval p̂ ± z√(p̂(1 − p̂)/n) is Omnicalculator's; GraphPad QuickCalcs gives exact intervals for a proportion and a Poisson count. All opened on 2026-11-10.
  • The t distribution is used when the standard deviation comes from your sample, the normal (z) distribution when the population standard deviation is known — the usual textbook rule; calculators that always use z are close for large samples (the table above shows the gap). Wilson, Clopper-Pearson and the exact Poisson interval are standard methods, checked against an independent calculation. Quantiles come from the t, normal, beta and chi-square distributions.
  • A confidence level describes the method, not one interval: it is the share of intervals built this way that would contain the true value if you repeated the study many times.

For information only. Check your own study design before drawing conclusions.

Common questions

How do I calculate a confidence interval?

For a mean, take the sample mean, divide the standard deviation by √n to get the standard error, multiply it by the critical value for your confidence level (t or z), then add and subtract that margin of error. A mean of 20.6, a standard deviation of 3.2 and n = 50 gives 0.9094 as the margin of error at 95% and an interval of 19.69 to 21.51.

What does a 95% confidence interval mean?

If you repeated the study many times and built an interval each time, about 95 of every 100 of those intervals would contain the true value. It does not mean there is a 95% chance that this one interval contains it — the true value is fixed, the interval is what varies.

How do I find a 90% or 99% confidence interval?

Tap the 90 or 99 chip (or type the level). The critical z value grows with the level: 1.645 at 90%, 1.960 at 95% and 2.576 at 99%, so the same data give a wider interval. For the mean above: 19.84 to 21.36 at 90% and 19.39 to 21.81 at 99%.

Should I use t or z?

Use t when the standard deviation comes from your sample (almost always), and z when the population standard deviation is known. The calculator picks t for a sample standard deviation and shows the z answer in a second row; with n = 100 the two margins are 0.5357 (t) and 0.5292 (z), and they converge as n grows.

How do I get a confidence interval for a proportion?

Switch to Proportion and type the number of yes answers and the sample size. 40 yes out of 100 gives 30.4% to 49.6% with the normal approximation, 30.9% to 49.8% with Wilson and 30.3% to 50.3% with the exact method. For small samples or proportions near 0% or 100% prefer Wilson or exact: 3 out of 40 gives 0.0% to 15.7% with the normal approximation (which would reach below 0%) but 2.6% to 19.9% with Wilson.

How big a sample do I need for a margin of error?

Go advanced and type the margin of error you want. For a proportion, ±3 percentage points at 95% needs 1,068 people in the worst case (p̂ = 50%), and ±5 points needs 385. For a mean with a standard deviation of 15, a margin of ±2 needs 217 people.

How do I get an interval for the difference between two groups?

Go advanced and choose Two groups, then type group 2. For two means the Welch method (no equal-variance assumption) is used: 52.3 (s = 4.5, n = 25) against 49.1 (s = 5.1, n = 25) gives a difference of 3.20 with a 95% interval of 0.46 to 5.94. If the interval includes 0 the data do not rule out no difference.

What if I only have the raw numbers?

Choose “List of numbers” and paste them separated by commas, spaces or new lines. The calculator works out n, the mean and the sample standard deviation, and uses the t distribution.

What if I know the standard error, a z-score or a p-value instead?

Go advanced: pick “Standard error” under how the spread is known, and set the confidence level from a z-score (for example 1.96) or a right-tailed p-value (0.025) instead of a percentage.

Can I get a confidence interval for a count?

Yes. Choose Count and type the number you counted: the exact Poisson interval for the average count is shown. A count of 10 gives 4.80 to 18.39 at 95%, while the normal approximation k ± z√k would give 3.80 to 16.20.