1. Home
  2. Calculate
  3. Confidence Interval Calculator

Confidence Interval Calculator

Mean and proportion confidence intervals, margin of error and sample size.

Runs in your browser · No upload Works offline
Sample standard deviation s
95% confidence interval
45.8722 ~ 54.1278
50 ± 2.0639 × 10 ÷ √25 = 50 ± 4.1278
Margin of error (±)
4.1278
Standard error SE
2
Critical t (df 24)
2.063899
Lower bound
45.8722
Upper bound
54.1278

How to use

  1. Choose a calculation and a confidence level (95% by default).
  2. Mean CI: enter the sample mean, standard deviation and sample size. Use t when the population standard deviation is unknown (the usual case) and z when it is known.
  3. Proportion CI: enter the number of successes x and the sample size n to get both the Wilson and Wald intervals.
  4. Sample size: enter the margin of error you want and get the required sample size, rounded up.

Formulas

Quantity Formula
Mean CI (t) x̄ ± t(α/2, n−1) × s ÷ √n
Mean CI (z) x̄ ± z(α/2) × σ ÷ √n
Proportion — Wald p̂ ± z × √(p̂(1 − p̂) ÷ n)
Proportion — Wilson (p̂ + z²/2n ± z√(p̂(1 − p̂)/n + z²/4n²)) ÷ (1 + z²/n)
Sample size (proportion) n = z² × p(1 − p) ÷ E²
Sample size (mean) n = (z × σ ÷ E)²
Finite population correction n = n₀ ÷ (1 + (n₀ − 1) ÷ N)

Common z values: 90% 1.6449, 95% 1.9600, 99% 2.5758. The t critical value depends on the degrees of freedom; instead of looking it up in a table, the tool computes it from the incomplete beta function (for example, df 24 at 95% → 2.0639).

Examples

  • Mean: 25 students average 50 points with a standard deviation of 10 → standard error 10 ÷ √25 = 2, t = 2.0639 → 95% CI 45.87 to 54.13 (margin ±4.13).
  • Proportion: 520 of 1,000 respondents say yes → p̂ = 52%, Wald margin 1.96 × √(0.52 × 0.48 ÷ 1,000) = ±3.1 points — the “margin of error ±3.1 percentage points at 95% confidence” often quoted for 1,000-person polls.
  • Sample size: at 95% confidence, a ±5-point margin needs 385 respondents and ±3 points needs 1,068. If the whole population is only 1,000 people, ±5 points needs 278.

Things to keep in mind

  • A 95% CI does not strictly mean “a 95% chance the true value is inside.” It means that if you repeated the sampling many times, about 95% of the intervals built this way would contain the true value.
  • With small samples or proportions near 0% or 100%, the Wald interval is too narrow or spills outside 0–100%. Use the Wilson interval there.
  • The margin of error assumes a random sample. It does not account for non-response, wording effects or a biased sampling frame.

FAQ

When should I use t instead of z?

Use t whenever you estimate the standard deviation from the sample itself — nearly every real analysis. With samples in the hundreds, t and z are almost identical.

What expected proportion should I use for sample size?

Use 50%. p(1 − p) is largest at p = 0.5, so it gives the most conservative sample size that holds whatever the result.

Where do I get the mean and standard deviation?

Paste your raw data into the average calculator to get the mean and sample standard deviation s first.

Coming soon

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.