Skip to main content
ilovecalcs logoilovecalcs.

Math · Live

Confidence interval calculator — mean & proportion at any level.

Calculate a confidence interval for a population mean (using Z or t) or a population proportion (Wald and Wilson score). Choose 90%, 95%, 99%, or any custom confidence level. Results update instantly.

How it worksReal-time

Inputs

CI for a mean

Auto: use t when n < 30 (unknown σ), Z when n ≥ 30. Override if you know the population σ.

%

95% Confidence interval

t-dist · df = 14

(21.9666,28.8334)
21.9666center28.8334
Margin of error
3.4334
ME = z* × SE
Standard error
1.6008
SE = σ/√n (or SE_p)
Critical value
2.1448
t*(14 df)

Interpretation

How to read this result

We are 95% confident that the true population mean (μ) lies between 21.9666 and 28.8334.

Common misconception: This does NOT mean there is a 95% probability that μ falls in this interval. μ is a fixed (unknown) value — it either is or isn't in this interval. The 95% refers to the procedure: if you repeated this study many times, 95% of the resulting intervals would contain the true μ.

What-if

CI width at different confidence levels

ConfidenceCritical valueMargin of errorInterval width
80%1.3452.15324.3063
90%1.76132.81965.6391
95%← current2.14483.43346.8669
99%2.97684.76549.5309
99.9%4.14056.628213.2564

Field guide

What a confidence interval really means and how to compute one.

What is a confidence interval?

A confidence interval (CI) is a range of values, computed from sample data, that is likely to contain the true (unknown) population parameter. The range comes with a stated confidence level — typically 90%, 95%, or 99%. That quantifies how often this procedure produces intervals that capture the true value.

CIs are fundamental to statistics because we almost never have access to an entire population. Instead we work with samples, which carry uncertainty. A CI converts that uncertainty into an explicit range, making the precision of our estimate visible.

The correct interpretation (a very common mistake)

The most pervasive misinterpretation of confidence intervals is:"There is a 95% probability that the true mean lies in this interval."This statement is incorrect. The population mean μ is a fixed (if unknown) value — it does not have a probability distribution. It either is or isn't in any particular interval.

The correct interpretation: "If we repeated this sampling procedure many times and computed a CI each time, 95% of those intervals would contain the true μ." The 95% confidence refers to the long-run reliability of the procedure, not to a specific interval's probability of containing μ.

CI for a population mean

When estimating a population mean from sample data, the general form is:

CI = x̄ ± (critical value) × (s / √n)

Where is the sample mean, s is the sample standard deviation, and n is the sample size. The terms / √n is the standard error (SE) — the standard deviation of the sampling distribution of the mean. Thecritical value × SE is the margin of error.

Z-interval vs t-interval

The choice of critical value depends on whether the population standard deviation σ is known and how large the sample is:

  • Z-interval (large n or known σ): When n ≥ 30 or when you know the true population σ, the critical value comes from the standard normal distribution. For a 95% CI, z* = 1.960.
  • t-interval (small n, unknown σ): When n < 30 and σ is unknown, the critical value comes from the Student's t-distribution with (n − 1) degrees of freedom. The t-distribution has heavier tails than the normal, producing wider intervals to account for the extra uncertainty. At n = 10 (df = 9), the 95% t* = 2.262 vs z* = 1.960.

As n increases, the t-distribution converges to the normal distribution. At n = 30, the 95% t* = 2.042, already close to 1.960. By n = 120, the difference is negligible.

CI for a proportion

When estimating a population proportion p, the sample estimate p̂ = x/n (where x is the number of successes and n is the sample size). The Wald CI (the most common form) is:

CI = p̂ ± z* × √(p̂(1 − p̂) / n)

This is mathematically simple but can behave poorly when p̂ is close to 0 or 1, or when n is small (it can produce intervals outside [0, 1] and has poor coverage for small samples).

Wilson score interval (recommended)

The Wilson score CI is generally preferred because it maintains better coverage probability, always stays within [0, 1], and performs well for extreme proportions and small n:

CI = (p̂ + z*²/2n ± z*√(p̂(1−p̂)/n + z*²/4n²)) / (1 + z*²/n)

For large n with p̂ far from 0 and 1, both intervals give nearly identical results. The difference becomes meaningful when p̂ < 0.1 or p̂ > 0.9, or when n < 30.

How confidence level affects CI width

A wider CI reflects more uncertainty, but also more confidence that the true value is included. The relationship is monotone: higher confidence → wider interval. Increasing from 95% to 99% multiplies the CI width by roughly 2.576 / 1.960 ≈ 1.31 (a 31% wider interval for 4 additional percentage points of confidence).

How sample size affects CI width

The margin of error is proportional to 1/√n. To halve the width of a CI, you need to quadruple the sample size. This square-root relationship is one of the most important practical constraints in study design — getting precise estimates requires disproportionately large samples. Our sample size calculator lets you work backwards from a desired margin of error.