Skip to content

Confidence Interval Calculator for a Mean or Proportion

This confidence interval calculator for mean values (t or z) and proportions turns summary statistics into lower and upper limits with the margin of error.

Interval for

The sample standard deviation, or the population value if it is known.

Method

Use t when the standard deviation comes from your sample (the usual case).

95% confidence interval

93.8083 to 106.191795% confidence interval for the mean: 100 ± 6.1917
Margin of error
± 6.1917
Standard error (s ÷ √n)
3
Critical value t*
2.063899
Degrees of freedom
24
Lower limit
93.8083
Upper limit
106.1917

Calculation: 100 ± 2.063899 × 15 ÷ √25

How to use the Confidence Interval Calculator

  1. Choose whether you want an interval for a mean (an average measurement) or a proportion (a share, such as the percentage who said yes).
  2. For a mean, enter the sample mean, the standard deviation and the sample size. For a proportion, enter the number of successes and the sample size.
  3. Pick a confidence level. 95% is the usual choice; 99% gives a wider, more cautious range.
  4. For a mean, keep the t method unless the population standard deviation is genuinely known in advance.
  5. Read the interval, the margin of error and the critical value; the calculation line shows the numbers that were used.

Formula

Mean: x̄ ± t* × s ÷ √n Proportion (Wilson): (p̂ + z²/2n ± z√(p̂(1 − p̂)/n + z²/4n²)) ÷ (1 + z²/n)

Where:

x̄
Sample mean, in the units of your data
s
Sample standard deviation (or σ, the population standard deviation, for the z method)
n
Sample size: the number of observations
s ÷ √n
Standard error of the mean: how much the sample mean typically varies between samples
t*
Critical value from Student's t distribution with n − 1 degrees of freedom, e.g. 2.0639 for 95% and n = 25
z
Critical value from the standard normal distribution: 1.6449 (90%), 1.9600 (95%), 2.5758 (99%)
p̂
Sample proportion: successes ÷ n, as a decimal between 0 and 1

The interval assumes a random sample of independent observations. The t interval also assumes the data are roughly normal, or that the sample is large enough (about 30 or more) for the sample mean to be. Formulas follow the NIST/SEMATECH e-Handbook of Statistical Methods §7.2.

Worked example

A store checks a random sample of 36 online orders. The average order is $84.50 with a sample standard deviation of $18.00. What is the 95% confidence interval for the average order value of all orders?

  1. Standard error = s ÷ √n = 18 ÷ √36 = 18 ÷ 6 = $3.00.
  2. Degrees of freedom = n − 1 = 35, so the 95% critical value is t* = 2.0301.
  3. Margin of error = t* × standard error = 2.0301 × 3.00 = $6.09.
  4. Lower limit = 84.50 − 6.09 = $78.41. Upper limit = 84.50 + 6.09 = $90.59.

The 95% confidence interval for the average order value is $78.41 to $90.59, or $84.50 ± $6.09.

Confidence interval formula for a mean

A sample mean is an estimate, and it would move if you drew a different sample. The interval x̄ ± t* × s ÷ √n puts a range around it. Take 16 randomly chosen deliveries with a mean time of 42.0 minutes and a sample standard deviation of 6.0 minutes, at 95% confidence:

  1. Standard error. s ÷ √n = 6.0 ÷ √16 = 1.5 minutes.
  2. Critical value. With n − 1 = 15 degrees of freedom, t* = 2.1314.
  3. Margin of error. 2.1314 × 1.5 ≈ 3.20 minutes.
  4. Interval. 42.0 − 3.20 = 38.80 and 42.0 + 3.20 = 45.20 minutes.

The result panel lists the same pieces as rows: margin of error, standard error, critical value, degrees of freedom and the two limits.

t or z: which interval to use

The standard deviation is almost always calculated from the same sample, so it is itself uncertain. Student's t distribution allows for that with a larger critical value, which is why t is the default method. Choose z only when the population standard deviation is known in advance, for example from a long-running, well-calibrated measurement process. For the deliveries, z would give 39.06 to 44.94, a little too narrow for 16 observations.

Confidence levelz*t* for n = 10t* for n = 30t* for n = 100
90%1.64491.83311.69911.6604
95%1.96002.26222.04521.9842
99%2.57583.24982.75642.6264

The two methods converge as the sample grows; at 1,000 observations the difference is negligible.

Confidence interval for a proportion (Wilson score)

For yes/no data, enter the number of successes and the sample size; no standard deviation is needed. The textbook Wald interval, p̂ ± z × √(p̂(1 − p̂) ÷ n), behaves badly in small samples and near 0% or 100%. With 0 successes out of 20 it returns exactly 0% to 0%, as if the sample proved the rate is zero.

The main answer is therefore the Wilson score interval, which shifts its center slightly toward 50% and never leaves the 0% to 100% range. For 0 out of 20 at 95% it gives 0% to 16.11%. The Wald interval is shown underneath for comparison with a textbook, marked with an asterisk when a limit has been cut off at 0% or 100%.

In a poll where 540 of 1,200 randomly selected adults support a proposal, p̂ is 45%, the standard error is 0.014361 and the Wald margin is about 2.81 points: 42.19% to 47.81%. Wilson gives 42.21% to 47.83%. With a large sample and a proportion near the middle, the two agree closely.

How to interpret a 95% confidence interval

The confidence level belongs to the method, not to one interval. If a hundred teams each drew a random sample and built a 95% interval the same way, roughly 95 of the intervals would contain the true value and about five would miss it. No team can tell which kind it has.

So it is not correct to say there is a 95% probability that the true mean lies between your two limits. Nor does the range cover 95% of individual observations: an interval for a mean is about the average and is usually far narrower than the spread of the data. For individual values you need a prediction interval instead.

Margin of error, standard error and critical value

These three rows explain every interval. The standard error measures how much the estimate varies between samples. The critical value converts the confidence level into a multiplier. Their product is the margin of error, the half-width that news reports quote as "45%, plus or minus 2.8 points".

Because the standard error falls with the square root of n, quadrupling the sample only halves the width. A higher confidence level works the other way: moving the delivery example from 95% to 99% raises t* from 2.1314 to 2.9467 and widens the interval by about 38%.

Assumptions and limits

  • Summary statistics only. There is no box for raw data. Get the mean and the sample standard deviation (dividing by n − 1) from the standard deviation page first, then enter them here.
  • One sample, two-sided. There is no interval for a difference between two means or two proportions, and no one-sided bound. Overlapping intervals from two groups do not prove there is no difference.
  • Fixed confidence levels. Choose from 80%, 85%, 90%, 95%, 98%, 99%, 99.5% and 99.9%.
  • Random, independent observations. An interval measures random sampling error only; a self-selected survey can be wrong in ways it does not reveal. The t interval also assumes roughly normal data or a sample of about 30 or more.
  • Large population. No finite population correction is applied.

Results are for study and planning. For regulated, clinical or published research, confirm the analysis with a qualified statistician.

Frequently asked questions

What is a 95% confidence interval in simple terms?

It is a range built from a sample by a method that captures the true population value 95% of the time. It describes the method, not one particular range. If you drew many random samples and built a 95% interval from each, about 95% of those intervals would contain the true value. For your single interval, the true value is either inside or not; 95% is how often the procedure succeeds.

How do I find a confidence interval with a mean and standard deviation?

Divide the standard deviation by the square root of the sample size to get the standard error, multiply it by the critical value for your confidence level, then subtract that margin from the mean and add it to the mean. With a mean of 84.50, a standard deviation of 18 and n = 36, the standard error is 3.00, t* is 2.0301 and the 95% interval is 78.41 to 90.59.

When should I use a t interval instead of z?

Use t whenever the standard deviation was calculated from your own sample, which is almost always the case. Use z only when the population standard deviation is known from outside the data, such as a long-established measurement process. For large samples the two give almost the same answer.

How do I calculate the margin of error with a confidence interval?

Multiply the critical value by the standard error. For a mean that is t* × s ÷ √n; for a proportion using the normal approximation it is z × √(p̂(1 − p̂) ÷ n). The interval is the estimate plus and minus that margin. Working backward from a published symmetric interval, the margin of error is half its width: (upper limit − lower limit) ÷ 2.

What is the z-score for a 95% confidence interval?

z* = 1.96 (more precisely 1.959964), the point that leaves 2.5% in each tail of the standard normal distribution. For 90% confidence it is 1.6449 and for 99% it is 2.5758. These values apply to the z method and to proportions. With the t method the critical value is larger and depends on the degrees of freedom, for example 2.0639 at 95% for n = 25.

Why does a bigger sample give a narrower interval?

The standard error is the standard deviation divided by the square root of n, so it shrinks as the sample grows, and the interval shrinks with it. Because of the square root, halving the margin of error needs about four times as many observations. Accepting a lower confidence level or reducing measurement noise, which lowers the standard deviation, also narrows the interval.

Last updated: