Confidence Interval

Compare Calculations

Downloads

Includes your inputs and results for this calculation, plus any additional calculations you've compared.

Good to Know

This calculator uses the z-distribution, which assumes a large sample size or a known population standard deviation. For small samples (fewer than about 30) with an estimated standard deviation, the t-distribution is technically more accurate and will produce a slightly wider interval than shown here.

How a Confidence Interval Is Calculated

A confidence interval is a range of values, built around a sample’s own mean, that likely contains the true population mean. Enter a sample’s mean, standard deviation, and size, choose a confidence level, and this calculator finds the range within which the actual population mean probably falls.

A “95% confidence interval,” for example, means that if you repeated the same sampling process many times, about 95% of the intervals it produced would contain the true population mean. It does not mean there’s a 95% chance the true mean falls inside this one specific interval — a common, technically-incorrect way people phrase it. A wider interval (higher confidence level) casts a wider net and is more likely to contain the true mean; a narrower interval is more precise but less certain.

The Formula

Standard Error=sn\vE{\text{Standard Error}} = \frac{\vA{s}}{\sqrt{\vB{n}}} Margin of Error=z×Standard Error\vF{\text{Margin of Error}} = \vC{z} \times \vE{\text{Standard Error}} Confidence Interval=xˉ±Margin of Error\text{Confidence Interval} = \vD{\bar{x}} \pm \vF{\text{Margin of Error}}

Where s\vA{s} is the sample’s standard deviation, n\vB{n} is the sample size, z\vC{z} is the critical value for the chosen confidence level (looked up from the standard normal distribution), and xˉ\vD{\bar{x}} is the sample mean. A bigger sample size shrinks the standard error — and therefore the whole interval — since more data gives a more precise estimate of the true mean.

Worked Example

A sample of 25 items has a mean of 100 and a standard deviation of 15, at a 95% confidence level (a critical value of z = 1.96):

    1. Standard error: Standard Error=15÷25=3\vE{\text{Standard Error}} = \vA{15} \div \sqrt{\vB{25}} = \vE{3}.
    2. Margin of error: Margin of Error=1.96×3=5.88\vF{\text{Margin of Error}} = \vC{1.96} \times \vE{3} = \vF{5.88}.
    3. Confidence interval: Confidence Interval=100±5.88=[94.12,105.88]\text{Confidence Interval} = \vD{100} \pm \vF{5.88} = [94.12, 105.88].

So the true population mean is likely (with 95% confidence) somewhere between 94.12 and 105.88.

Key Factors to Consider

  • A confidence interval says nothing about how the sample was collected. The math here assumes the sample is a genuinely random, representative sample of the population — a biased or non-random sampling method can produce a confidence interval that looks precise but is centered on the wrong value entirely, a problem this formula cannot detect or correct for.
  • The interval assumes the underlying data is at least approximately normally distributed, or that the sample is large enough for the Central Limit Theorem to apply. For a small sample from a heavily skewed distribution, both the z-distribution and t-distribution approximations become less reliable.
  • A confidence interval and a margin of error reported in a poll or survey describe the same underlying idea. A news report citing “a margin of error of plus or minus 3 percentage points” at a stated confidence level (often 95%) is describing exactly the interval this calculator computes, just phrased differently.
  • Narrower isn’t always better if it comes at the cost of confidence. A tighter interval at a lower confidence level (say 80% instead of 95%) is more precise but less likely to actually contain the true value — the right tradeoff between precision and confidence depends on what the estimate is being used for.

Common Mistakes

  • Reading “95% confidence” as “95% probability the true mean is in this interval.” Once a sample has actually been collected and the interval computed, the true population mean either is or isn’t inside it — there’s no probability left to talk about. The 95% describes the long-run behavior of the method across many repeated samples, not this one specific result.
  • Applying this z-based formula to a small sample without checking the assumptions. The z-distribution assumes either a large sample (conventionally n of about 30 or more) or a known population standard deviation. A small sample with only an estimated standard deviation should technically use the t-distribution instead, which produces a somewhat wider — and more honest — interval.
  • Confusing the confidence interval with the range of the raw data. The interval describes uncertainty about the population mean, not where individual data points fall — a dataset can have values spread far wider than its confidence interval while the interval on the mean itself stays narrow, especially with a large sample.

Useful to Know

Because the standard error shrinks with the square root of the sample size rather than the sample size itself, cutting a margin of error in half generally means roughly quadrupling the sample size, not just doubling it — a detail that matters when planning how large a survey or experiment actually needs to be. This is also why polls with only a few hundred respondents can still report a respectably tight margin of error: once a sample reaches a few hundred, the square-root relationship means each additional respondent buys progressively less precision, so pollsters rarely see much value in pushing sample sizes into the tens of thousands just to shave a fraction of a point off the margin.

Source: Standard statistical inference formula using the z-distribution.

Frequently Asked Questions

What does "95% confidence" actually mean?

It means that if you repeated the same sampling process many times, about 95% of the resulting intervals would contain the true population mean. It does NOT mean there is a 95% chance the true mean falls inside this ONE specific interval — a common but technically incorrect way to phrase it.

Why does a bigger sample size shrink the interval?

The standard error (and therefore the margin of error) is divided by the square root of the sample size, so more data produces a more precise — and narrower — estimate of the true population mean.

Should I use the z-distribution or the t-distribution?

The z-distribution (used here) is standard for large samples (n of about 30 or more) or when the population's true standard deviation is already known. For a small sample with only an estimated standard deviation, the t-distribution is technically more accurate and produces a slightly wider interval.

What happens if I choose a higher confidence level?

A higher confidence level (e.g. 99% instead of 95%) uses a larger critical z-value, which widens the interval. This is an unavoidable trade-off: casting a wider net makes it more likely the true mean is actually inside the interval, at the cost of a less precise estimate.

How much bigger does my sample need to be to cut the margin of error in half?

About four times bigger, not two. The standard error shrinks with the square root of the sample size, so halving the margin of error requires quadrupling the number of observations — a useful rule of thumb when planning how large a survey or experiment actually needs to be.

Does a confidence interval say anything about how the sample was collected?

No — the math assumes the sample is genuinely random and representative of the population. A biased or non-random sampling method can still produce a confidence interval that looks precise but is centered on the wrong value entirely, a problem this formula has no way to detect or correct for.

Is a confidence interval the same thing as a margin of error?

They describe the same underlying idea from two angles: the margin of error is the plus-or-minus distance from the sample mean, while the confidence interval is the full range that distance creates around it. A news report citing "a margin of error of plus or minus 3 percentage points" at a stated confidence level is describing exactly the interval this calculator computes.

Confirm Your Age

To create an account, please tell us your birth month and year.