Skip to content

Confidence Interval For Mean Calculator

Calculate confidence intervals for the population mean from sample data.

By CalcGenius Editorial TeamLast reviewed August 28, 20253 min read
Confidence Interval for the Mean — x̄ ± z × (s / √n)

Uses the z-interval (large-sample normal approximation). For small samples (n < 30) with unknown σ, the t-distribution gives a wider interval — use the one-sample t-test calculator for that case.

📊
Enter your values and click Calculate

About

A confidence interval is a range of plausible values for an unknown population parameter, computed from a sample. The two-sided interval for a population mean is x̄ ± z × (s / √n), where x̄ is the sample mean, s is the sample standard deviation, n is the sample size, and z is the critical value of the standard normal distribution at the chosen confidence level. A 95% confidence interval means that if you repeated the sampling procedure many times, about 95% of the resulting intervals would contain the true population mean.

The standard error s / √n measures how much the sample mean would vary from sample to sample. It is the standard deviation of the sampling distribution of x̄ — and it shrinks as 1/√n. The margin of error ME = z × SE sets the half-width of the interval. Larger z (higher confidence) widens the interval; larger n or smaller s shrinks it. Reports like "53% ± 3%" quote the margin of error at 95% confidence, meaning the true value is plausibly in [50%, 56%] given sampling variation alone.

The choice of z-score sets the confidence level. For 90% confidence, z = 1.645 (leaves 5% in each tail); for 95%, z = 1.96 (leaves 2.5% in each tail); for 99%, z = 2.576 (leaves 0.5% in each tail). Higher confidence demands a wider interval — you cannot simultaneously have high confidence and a narrow interval unless you collect more data. The conventional choice in most fields is 95%, striking a balance between confidence and precision.

For small samples (n < 30) with unknown σ, the z-interval is too narrow because it does not account for the extra uncertainty in estimating σ from a small sample. Use the t-distribution instead: x̄ ± t × (s / √n), where t is the critical value of Student's t-distribution with n − 1 degrees of freedom. The t-distribution has heavier tails than the normal, giving wider intervals that properly account for the sampling variability of s. As n grows, the t-distribution converges to the normal — at n = 30 the difference is negligible for most practical purposes.

The confidence interval rests on three assumptions: (1) the data is a simple random sample from the population of interest; (2) the sampling distribution of x̄ is approximately normal — guaranteed by the central limit theorem for n ≥ 30, but requiring approximate normality of the population for smaller n; and (3) observations are independent. For proportions, use the Wilson score interval instead of the naive z-interval; for highly skewed data, consider a bootstrap or transform first.

How to Use

  1. 1
    Enter the sample mean x̄
    Type the arithmetic average of your sample. If you only have raw data, use the Average Calculator first to compute x̄.
  2. 2
    Enter the sample standard deviation s
    Type the standard deviation of your sample. Use the sample formula (÷ (n − 1)) if the data is a sample from a larger population.
  3. 3
    Enter the sample size n
    Type the number of observations. Must be ≥ 2. For n &lt; 30 the t-interval is more appropriate — this calculator uses z, which is a good approximation for n ≥ 30 by the central limit theorem.
  4. 4
    Choose the confidence level
    Select 90%, 95%, or 99% confidence. 95% is the convention in most social sciences; 99% is common in physics and quality control where false alarms are costly.
  5. 5
    Read margin of error and bounds
    The hero shows the full confidence interval [lower, upper]. Below: margin of error, lower bound, upper bound, and the standard error used.

Formula

Confidence interval for the mean (z, large sample):

CI = x̄ ± z × (s / √n)
ME = z × (s / √n) (margin of error)
Lower = x̄ − ME, Upper = x̄ + ME

z-scores for two-sided intervals:

90% → z = 1.645 (leaves 5% in each tail)
95% → z = 1.96 (leaves 2.5% in each tail)
99% → z = 2.576 (leaves 0.5% in each tail)

Small-sample t-interval (n < 30, σ unknown):

CI = x̄ ± t_(n−1) × (s / √n)
where t_(n−1) is the critical value of Student's t with (n − 1) df

Standard error and margin of error:

SE = s / √n (standard error of the mean)
ME = z × SE (margin of error)

Worked Example

Example 1 — 95% CI for average height (n = 30):

  • Sample mean x̄ = 170 cm, s = 8 cm, n = 30.
  • SE = 8 / √30 ≈ 1.4606 cm.
  • ME = 1.96 × 1.4606 ≈ 2.8627 cm.
  • 95% CI = [170 − 2.8627, 170 + 2.8627] = [167.14, 172.86] cm.
  • We are 95% confident the true mean height is between 167.14 and 172.86 cm.

Example 2 — Same data, but 99% CI:

  • ME = 2.576 × 1.4606 ≈ 3.7633 cm.
  • 99% CI = [166.24, 173.76] cm.
  • Higher confidence (99% vs 95%) widens the interval by about 31%.

Example 3 — Opinion poll (proportion):

  • 1,000 voters surveyed, 530 favor candidate A → p̂ = 0.53.
  • SE = √(0.53 × 0.47 / 1000) ≈ 0.01578.
  • ME = 1.96 × 0.01578 ≈ 0.0309 (about 3.1 percentage points).
  • 95% CI for the true proportion = [0.499, 0.561] = [49.9%, 56.1%].

Tips

  • Margin of error scales as 1/√n — to halve the margin, quadruple the sample size. This is the fundamental tradeoff between precision and cost in survey design.
  • For small samples (n &lt; 30) with unknown σ, use the t-distribution instead of z. The t-distribution has heavier tails to account for the extra uncertainty in estimating σ from a small sample.
  • Common z-scores: 90% → 1.645, 95% → 1.96, 99% → 2.576. The 1.96 comes from the central 95% of the standard normal distribution; it leaves 2.5% in each tail.
  • A 95% confidence interval does NOT mean there is a 95% probability the true value is inside — the true value is fixed, the interval is random. The 95% refers to the long-run coverage rate if you repeated the procedure.
  • For a proportion (binary outcome) with sample proportion p̂, use ME = z × √(p̂(1 − p̂)/n). The worst-case sample size for a given margin is when p̂ = 0.5, giving ME = z × 0.5 / √n.

Common Mistakes

Warning

The most common mistake is interpreting a 95% confidence interval as "there is a 95% probability the true value is in this interval." The true value is fixed; the interval is random. The 95% refers to the long-run coverage rate — if you repeated the procedure 100 times, about 95 of the intervals would contain the true value. A second error is using the z-interval for small samples with unknown σ — the t-distribution is correct in that case. A third error is computing the interval after excluding outliers or selecting subsamples — the confidence statement only holds for the procedure as actually performed.

Frequently Asked Questions

What is a confidence interval?
A confidence interval is a range of plausible values for an unknown population parameter, computed from a sample. A 95% confidence interval means that if you repeated the sampling procedure many times, about 95% of the resulting intervals would contain the true parameter. It does NOT mean there is a 95% probability that the true value is in your single observed interval — the true value is fixed, the interval is random.
When should I use the z-interval vs the t-interval?
Use the z-interval when the population standard deviation σ is known, or when the sample size is large (typically n ≥ 30) so the sample standard deviation s is a good estimate of σ. Use the t-interval when σ is unknown and n is small (typically n &lt; 30); the t-distribution has heavier tails to account for the extra uncertainty in estimating σ from a small sample.
What z-score corresponds to 90%, 95%, 99% confidence?
For a two-sided interval: 90% uses z = 1.645 (leaves 5% in each tail), 95% uses z = 1.96 (leaves 2.5% in each tail), and 99% uses z = 2.576 (leaves 0.5% in each tail). Higher confidence requires a larger z, which widens the interval — there is a tradeoff between confidence and precision.
How does sample size affect the margin of error?
Margin of error = z × (s / √n), so it shrinks as 1/√n. To halve the margin of error you must quadruple the sample size. This is why pollsters need enormous samples for tight margins: a 1,500-voter poll has roughly ±2.5% margin of error at 95% confidence; cutting that to ±1.25% requires 6,000 voters.
What is the margin of error?
The margin of error is half the width of the confidence interval: ME = z × (s / √n). It quantifies the maximum expected sampling error at the chosen confidence level. Reports like &quot;53% ± 3%&quot; mean the 95% confidence interval is 50% to 56% — the true value is likely in that range given sampling variation alone.
Why do I need to assume normality?
The z- and t-intervals assume the sampling distribution of the mean is normal. By the central limit theorem, this holds approximately for any population when n is large (rule of thumb: n ≥ 30). For small samples from a clearly non-normal population, the interval may be unreliable; consider a non-parametric bootstrap or transform the data first.

Confidence interval

A confidence interval is a range that plausibly contains the true population parameter, computed from sample data. The formula x̄ ± z × (s / √n) gives a two-sided interval for the population mean. The confidence level (90%, 95%, 99%) is the long-run proportion of intervals that would contain the true parameter if you repeated the sampling indefinitely.

z-score

The z-score sets how many standard errors wide the interval is. For 95% confidence, z = 1.96 because the central 95% of the standard normal distribution falls within ±1.96 standard deviations of the mean. Higher confidence levels require larger z (z = 2.576 for 99%), widening the interval. Common z-scores: 90% → 1.645, 95% → 1.96, 99% → 2.576.

Margin of error

The margin of error ME = z × (s / √n) is half the interval width. It shrinks with larger samples (as 1/√n), tighter data (smaller s), or lower confidence (smaller z). Polls quote ±3% because a 1,000-person sample at 95% confidence has ME ≈ 1.96 × 0.5 / √1000 ≈ 0.031 (using the worst-case s = 0.5 for a binary outcome).

Sample size matters

Because margin of error scales as 1/√n, doubling sample size shrinks the interval by a factor of √2, not 2. To halve the margin of error you must quadruple the sample. This is the fundamental reason high-precision polls, surveys, and experiments are expensive: precision grows slowly with sample size.

Same data (x̄ = 50, s = 8, n = 30) at three confidence levels. Higher confidence widens the interval.
Confidence levelz-scoreMargin of errorIntervalWidth
90%1.645± 2.4027[47.5973, 52.4027]4.8054
95%1.96± 2.8628[47.1372, 52.8628]5.7255
99%2.576± 3.7625[46.2375, 53.7625]7.5250
Info

The margin of error formula ME = z × (s / √n) shows the fundamental tradeoff in survey design: precision (small ME) requires either high confidence (small z — but you cannot go below z = 0), small variability (small s — controlled by measurement, not sample size), or large samples (large n). The 1/√n scaling is brutal: doubling precision quadruples cost. This is why a 1,500-voter poll has roughly ±2.5% margin of error at 95% confidence, while a 600-voter poll has ±4%.

Pro tip

When planning a study, invert the margin-of-error formula to compute required sample size: n = (z × s / ME)². For a proportion, use the conservative worst case s = 0.5. So to achieve a ±3% margin of error at 95% confidence for a proportion, n ≥ (1.96 × 0.5 / 0.03)² ≈ 1,067. This is the origin of the "1,000-person poll" rule of thumb in political surveying.

Authoritative References

  • Wikipedia — Confidence interval— wikipedia.org
    Comprehensive treatment of confidence intervals, including frequentist interpretation, comparison with Bayesian credible intervals, and common misinterpretations.
  • Khan Academy — Confidence intervals— khanacademy.org
    Khan Academy unit on confidence intervals and margin of error, with videos and exercises on z- and t-intervals.
  • Stat Trek — Confidence Intervals— stattrek.com
    Stat Trek reference on confidence intervals for means and proportions, with worked examples and critical value tables.

Try our other free calculators

CalcGenius has 1,200+ free, ad-free, browser-based calculators for finance, health, math, science, and everyday life. No sign-up required.

95% Confidence Interval Range — Sample Margin Estimator