Confidence Interval Calculator
Calculate confidence intervals for means, proportions, and the difference between two means. See the interval, the working, and what it all means.
If you paste data, x̄ and s will be calculated; n is counted automatically.
§1How this was calculated
—Waiting for input.
§2The formula
—
§3Worked example
§4Assumptions and edge cases
When these formulas break down
- Sample size too small: The t-interval assumes normality; with n < 30, check a Q–Q plot or use a bootstrap if the data looks skewed.
- Known σ is rare: The z-interval for known population SD is textbook material; in practice, you almost always know only s, so use the t-interval.
- Proportion edge cases: When x = 0 or x = n, the Wald interval degenerates to zero width. The Wilson score interval stays sensible.
- Unequal variances: The Welch t-test (used here) does not assume equal variances. If you know they are equal, Welch is conservative but valid.
§5Confidence level, margin of error, and sample size — the three-way trade-off
You always face a three-way trade-off:
- Raise confidence (e.g. 95% to 99%) → wider interval (larger margin of error).
- Shrink the margin of error → either lower confidence or raise n.
- Raise sample size → narrower interval at the same confidence level.
Most fields use 95% confidence as a convention, but there is nothing magical about it. Clinical trials might use 99%, while a quick survey might use 90%. Choose based on the cost of a mistake, not the number.
§7What a confidence interval does not mean
Common mistake: "There is a 95% probability that the true mean lies in this interval."
That is not what a 95% confidence interval means. Once you have computed the interval—say, [40.2, 43.1]—the true mean is either in it or it is not. The probability is either 0 or 1, not 0.95.
What it actually means: "If I repeated this study many times, calculated a 95% confidence interval each time, about 95% of those intervals would contain the true population value." The 95% is a property of the method, not of any single interval you compute.
This is a frequentist interpretation. Bayesian methods assign probability to the unknown parameter directly, which can sound more intuitive but requires prior assumptions.
§8How to report a CI in APA style
Use square brackets, state the confidence level, and use the form M = [lower, upper].
Examples:
- The mean reaction time was 420 ms, 95% CI [410, 430] ms.
- The proportion of responders was 0.68, 95% CI [0.61, 0.75].
- The difference in means was 3.2 units, 95% CI [1.5, 4.9].
Always state the confidence level. Do not omit it.
§9FAQ
Why t instead of z for the mean?
When you do not know the population SD (σ) and must estimate it from the sample (s), the sampling distribution of the mean has heavier tails than a normal distribution. The t-distribution accounts for this extra uncertainty. Use t whenever you use sample SD, which is almost always.
What is the difference between the Wald and Wilson intervals?
The Wald interval, p̂ ± z√(p̂(1−p̂)/n), is simpler but fails when the sample proportion is near 0 or 1. The Wilson score interval always stays within [0, 1] and has the correct coverage even for extreme proportions and small samples. Modern software defaults to Wilson.
If my 95% CI is [40.2, 43.1], is there a 95% chance the true mean is in there?
No. Once computed, the interval either contains the true mean or it does not. The 95% refers to the long-run coverage of the method: if you repeated the study and calculation many times, 95% of the resulting intervals would contain the true value. Any single interval you calculate has either covered the true value (probability 1) or missed it (probability 0).
Can I compute a confidence interval from raw data?
Yes. For the mean (σ unknown), paste your data into the textarea (comma, space, tab, or newline separated). The calculator will compute the sample mean, SD, and n automatically. For other modes, you supply the summary statistics directly.
How do I choose a confidence level?
95% is a convention in most fields, but it is not mandatory. Use 90% if you can tolerate more uncertainty and want a narrower interval. Use 99% if you need high assurance (e.g., clinical safety). The choice reflects the cost of a Type II error and the precision you need, not a statistical law.
What do I do if my sample size is very small (n < 10)?
The CI formulas still apply, but the interval will be wide and the coverage can be poor if the data are not approximately normal. For small samples, either (a) collect more data if possible, (b) check normality visually, or (c) use a bootstrap or non-parametric method if the data are severely skewed.
§10Related tools
§11Sources
- OpenIntro Statistics — Open-source statistics textbook covering CIs, hypothesis testing, and regression.
- Binomial Proportion Confidence Interval (Wikipedia) — Comprehensive overview of Wald, Wilson, Clopper–Pearson, and other methods for proportions.
- NIST Engineering Statistics Handbook — Official reference for distributions, critical values, and statistical methods.
- Agresti & Coull (1998), "Approximate is Better than 'Exact' for Interval Estimation of Binomial Proportions" — Classic paper on why Wilson score intervals are superior for proportions.
- Welch (1947), "The Generalization of Student's Problem when Several Different Population Variances are Involved" — Foundation for the Welch t-test and unequal-variance CI for difference of means.