Skip to content
CalcHub

Confidence Interval Calculator

Calculate a confidence interval for a mean from the sample mean, standard deviation, and size, with the margin of error and standard error at your chosen confidence level.

Confidence Interval CalculatorLive

How to use this calculator

  1. 1Enter the sample mean and the sample standard deviation.
  2. 2Enter the sample size.
  3. 3Choose your confidence level — 95% is the usual default.
  4. 4Read the confidence interval and the margin of error around the mean.

How it works

Confidence interval for a mean

standard error = SD ÷ √n
margin of error = z × standard error
interval = mean ± margin of error
z: 1.96 for 95%, 1.645 for 90%, 2.576 for 99%

A confidence interval is a range, built from a sample, that is likely to contain the true value of a population parameter — here, the population mean. It is centred on the sample mean and extends a margin of error on either side. The margin comes from two ingredients: the standard error, which measures how much the sample mean would vary from sample to sample (the standard deviation divided by the square root of the sample size), and a critical value that reflects how confident you want to be. A higher confidence level uses a larger critical value and so produces a wider interval — the price of greater certainty is a less precise range. A larger sample shrinks the standard error and narrows the interval, because bigger samples estimate the mean more precisely. The interval quantifies the uncertainty in an estimate rather than pretending a single sample mean is the exact truth.

Worked example

A sample of 30 with a mean of 100 and a standard deviation of 15 has a standard error of 15 ÷ √30 ≈ 2.74. At 95% confidence the critical value is 1.96, so the margin of error is 1.96 × 2.74 ≈ 5.37, giving an interval of about 94.63 to 105.37 — the range likely to contain the true mean.

Confidence Interval Calculator: the complete guide

What a confidence interval really says

A confidence interval acknowledges a basic truth of sampling: a sample mean is an estimate, not the exact population value, and estimates come with uncertainty. Rather than reporting a single number and pretending it is precise, a confidence interval reports a range and attaches a confidence level to it. It says, in effect, 'our best estimate is this, and the true value is plausibly somewhere in this range.' This is a far more honest and useful way to communicate a result than a lone figure with no sense of its reliability.

The exact meaning of the confidence level is subtle and widely misstated. A 95% confidence interval does not mean there is a 95% probability that the true mean lies within this particular interval — the true mean is a fixed number, either in the interval or not. What it means is that the procedure works 95% of the time: if you drew many samples and built an interval from each, about 95% of those intervals would capture the true mean. The confidence is in the method, over many repetitions, not in any single interval. This distinction matters for interpreting statistics correctly, even though the practical takeaway — that the range is a good bet for the true value — is the same.

What makes an interval wide or narrow

The width of a confidence interval is controlled by three factors, and understanding them helps you design better studies and read results critically. The first is the confidence level: demanding more confidence, say 99% instead of 95%, requires a larger critical value and therefore a wider interval. There is an unavoidable trade-off between confidence and precision — you can be more certain, but only about a vaguer range, or more precise, but with less certainty.

The second and most controllable factor is the sample size. The margin of error shrinks with the square root of the sample size, so quadrupling the sample halves the margin. This is why larger studies produce tighter, more precise estimates, and why increasing the sample is the main lever for narrowing an interval. The third factor is the variability in the data itself: a larger standard deviation means more spread and a wider interval, because a noisier population is harder to pin down. You cannot change the population's variability, but you can collect a bigger sample to compensate for it.

z, t, and when the assumptions matter

This calculator uses the z-value from the normal distribution to set the critical value, which is the right choice when the sample is large or when the population standard deviation is genuinely known. For a strictly correct interval from a small sample where the standard deviation is estimated from the data — as it usually is — statisticians use the t-distribution instead, which has slightly fatter tails and produces a marginally wider interval to account for the extra uncertainty in estimating the standard deviation. For samples above about 30, the two are close enough that the difference rarely matters, which is why the z-based interval is a reasonable default.

Beyond the choice of distribution, confidence intervals rest on assumptions worth remembering. They assume the sample is random and representative of the population — an interval built from a biased sample is precisely wrong, no matter how narrow. They also assume, for the mean, that the sampling distribution is roughly normal, which holds for large samples by the central limit theorem even when the underlying data are not normal. Used with these assumptions in mind, confidence intervals are one of the most valuable tools in statistics, turning the inevitable uncertainty of sampling into an explicit, quantified range rather than a hidden weakness.

Frequently asked questions

How do I calculate a confidence interval?

Find the standard error (standard deviation ÷ √n), multiply by the critical value for your confidence level (1.96 for 95%) to get the margin of error, then take the mean plus or minus that margin. A mean of 100, SD 15, n 30 gives about 94.63 to 105.37 at 95%.

What does a 95% confidence interval mean?

It means the method captures the true mean 95% of the time: if you repeated the sampling many times, about 95% of the intervals built this way would contain the true population mean. It does not mean a 95% chance the true mean is in this specific interval.

How can I make a confidence interval narrower?

Increase the sample size — the margin of error shrinks with the square root of n, so quadrupling the sample halves it. You can also accept a lower confidence level, which uses a smaller critical value. Less data variability also narrows it, but that's a property of the population.

Should I use z or t for the critical value?

Use z (normal) for large samples or a known population standard deviation. For small samples with an estimated standard deviation, the t-distribution is strictly correct and gives a slightly wider interval. Above about n = 30 the two are close, so z is a fine default.