Statistics

Confidence Interval Calculator

A confidence interval gives a range that likely contains the true population mean. This calculator uses x̄ ± z*·(s/√n), reporting the critical value, the standard error and the margin of error for a 90%, 95% or 99% level.

Confidence Interval Calculator

Confidence interval for a population mean.

Try:
Answer95% CI = (47.5208, 52.4792)
  1. Givenx̄ = 50, s = 8, n = 40, level = 95%
  2. Critical valuez* = 1.96
  3. Standard errorSE = s / √n = 8 / √40 = 1.26491
  4. Margin of errorE = z*·SE = 1.96·1.26491 = 2.47923
  5. Intervalx̄ ± E = (47.5208, 52.4792)

Turning an estimate into a range

A sample mean is an estimate, and an estimate on its own says nothing about how far off it might be. A confidence interval attaches that missing information: it reports a range around the sample mean, built so that intervals constructed this way capture the true population mean a stated proportion of the time.

This calculator takes a sample mean, a standard deviation and a sample size, and returns the interval at a 90%, 95% or 99% level, along with the critical value, the standard error and the margin of error that produced it.

The interval is the deliverable, but the three intermediate quantities make it interpretable: the standard error says how much a mean of this size varies, the critical value says how many standard errors the level demands, and their product is the margin of error.

Seeing them separately explains the width. A wide interval is usually a small-sample problem rather than a noisy-data one, and only the standard-error line tells those apart.

How to use this calculator

  1. Enter the sample mean The average of your observed data, not a hypothesised or target value. It becomes the centre of the interval, so the result is always symmetric about it.
  2. Enter the standard deviation The spread of the individual observations, which must be positive. This is s, not the standard error: the tool divides by √n itself, so an already-divided value shrinks the interval wrongly.
  3. Enter the sample size A whole number of at least 2. The solver rejects anything smaller with an explicit message rather than computing a meaningless interval from a single observation.
  4. Choose the confidence level 90%, 95% or 99%. Higher confidence buys width, not a better estimate: the centre never moves.

The formula, and where it comes from

SE = s / √n E = z*·SE CI = x̄ ± E

The standard error is the standard deviation of the sampling distribution of the mean: observations vary by s, but averages of n of them vary by only s/√n. That square root is why quadrupling the sample only halves the interval, and why precision gets expensive quickly.

The critical value z* is how many standard errors cover the chosen proportion of a standard normal distribution. The implementation uses three fixed published values — 1.645, 1.96 and 2.576 — rather than computing a quantile, which is why only three levels are offered.

Multiplying gives the margin of error; adding and subtracting it from the mean gives the bounds. The interval is symmetric by construction — a property of the method, not of the data.

What each input means

x̄ Sample mean — form field “Sample mean x̄”
The average of your observations. It sits at the centre of the reported interval. Units: same as the measured quantity.
s Sample standard deviation — form field “Standard deviation s”
How much individual observations vary. Must be strictly positive; a value of zero would describe data with no variation at all and is rejected. Units: same as the measured quantity.
n Sample size — form field “Sample size n”
The number of observations, a whole number of at least 2. It enters only through √n, so its effect on the interval width diminishes as it grows. Units: observations.
z* Critical value — form field “Confidence level”
Set by the confidence level rather than entered: 1.645, 1.96 or 2.576. These are standard normal quantiles, so the method assumes normality of the sampling distribution.

Worked examples

Every number below is produced by the same calculation engine the tool above runs. Nothing here is typed by hand, so the walkthrough cannot drift from what you get when you enter the same values yourself.

A 95% interval from forty observations

A sample of 40 with a mean of 50 and a standard deviation of 8 — a moderate sample where the normal approximation is comfortable.

Inputs Sample mean x̄ = 50, Standard deviation s = 8, Sample size n = 40, Confidence level = 95

  1. Given x̄ = 50, s = 8, n = 40, level = 95%
  2. Critical value z* = 1.96
  3. Standard error SE = s / √n = 8 / √40 = 1.26491
  4. Margin of error E = z*·SE = 1.96·1.26491 = 2.47923
  5. Interval x̄ ± E = (47.5208, 52.4792)

Result 95% CI = (47.5208, 52.4792)

The standard error is 8/√40, well under 1.3, even though individual observations vary by 8. That contraction is the whole point of averaging: the mean of a sample is far more stable than any single measurement in it.

The margin of error is just under 2.5, so the interval spans roughly 47.5 to 52.5. Quoting the mean as 50 without that range would imply a precision the data does not support.

Higher confidence on a larger sample

A sample of 100 with a mean of 120 and a standard deviation of 15, at the 99% level. Both the sample and the confidence demand have increased.

Inputs Sample mean x̄ = 120, Standard deviation s = 15, Sample size n = 100, Confidence level = 99

  1. Given x̄ = 120, s = 15, n = 100, level = 99%
  2. Critical value z* = 2.576
  3. Standard error SE = s / √n = 15 / √100 = 1.5
  4. Margin of error E = z*·SE = 2.576·1.5 = 3.864
  5. Interval x̄ ± E = (116.136, 123.864)

Result 99% CI = (116.136, 123.864)

The critical value rises from 1.96 to 2.576, widening the interval by about 31% for the same data. Higher confidence is not a free improvement: it is bought entirely with width.

The larger sample pulls the other way through √100 = 10 in the denominator. The two effects partly cancel, which is why 99% confidence is affordable on a large sample and painful on a small one.

Reading the result

What 95% confidence actually means

It is a statement about the procedure, not this interval. Repeat the sampling many times, build an interval each time, and about 95% would contain the true mean. This one either does or does not.

This is an interval for the mean, not for an observation

The interval describes where the population average plausibly lies. It does not say that 95% of individual values fall inside it — that would be a prediction interval, which is much wider and is not computed here.

When you would use this

Reporting a measured average honestly

Any summary of sampled data — average response time, mean yield, typical spend — is more informative with an interval attached, since it separates signal from sampling noise.

Deciding whether a sample is large enough

Trying candidate values of n with a plausible standard deviation shows what margin of error each buys — the practical way to size a study before collecting anything.

Assumptions and limitations

What this calculator assumes

  • The sampling distribution of the mean is approximately normal, which is what licenses the z critical values.
  • The standard deviation entered is the spread of the observations, not the standard error; the division by √n is performed internally.
  • Only the three published critical values 1.645, 1.96 and 2.576 are available, so intermediate confidence levels cannot be requested.

Where it stops being the right tool

  • The method uses z rather than t, so for small samples with an estimated standard deviation the interval is slightly too narrow. With n below about 30 a t-based interval is the correct choice.
  • Means only. Intervals for a proportion, a variance or a difference between two groups use different formulas.

Common mistakes

Entering the standard error instead of the standard deviation

Why it happens. Software often reports the standard error alongside the mean, and both are labelled as measures of spread. Feeding it in means dividing by √n twice.

How to avoid it. Enter the spread of the raw observations. Check the standard-error line: it should be noticeably smaller than the number you typed, and if it is not, the division has happened twice.

Reading the interval as covering 95% of the data

Why it happens. The phrase “95% confidence interval” invites that reading, and for a large sample the interval is narrow enough to look like a description of the data rather than of the mean.

How to avoid it. Remember the interval is about the average. For a range covering individual observations you need a prediction interval, which is far wider and is not what this tool computes.

Using z with a small sample

Why it happens. The tool accepts any n of 2 or more, so nothing prevents a 95% interval from six observations. With s estimated from so little data, the normal critical value understates the uncertainty.

How to avoid it. For n under roughly 30, use a t-based interval with n − 1 degrees of freedom. The t critical value is larger, giving the wider interval the small sample deserves.

Sources and further reading

  • NIST/SEMATECH e-Handbook of Statistical Methods National Institute of Standards and Technology Reference for the standard normal critical values 1.645, 1.96 and 2.576 used at the 90%, 95% and 99% levels, and for the distinction between z- and t-based intervals.

Key terms

Frequently asked questions

What does a 95% confidence interval mean?

That the procedure captures the true population mean about 95% of the time in repeated sampling. It is a property of the method, not a probability statement about this one interval, which either contains the mean or does not.

What is the margin of error?

The half-width of the interval, z*·(s/√n). It is how far each bound sits from the sample mean, and it combines the chosen confidence level with the precision the sample size affords.

Why does a larger sample give a narrower interval?

Because the standard error is s/√n, so it shrinks as the sample grows. The square root means the return diminishes: four times the data halves the margin of error, and sixteen times quarters it.

Should I use this for a small sample?

Not ideally. The calculator uses fixed z critical values, which assume the sampling distribution is normal. When n is below about 30 and the standard deviation is estimated from the sample, a t-based interval with n − 1 degrees of freedom is wider and more appropriate.