Confidence Interval Calculator
Compute a confidence interval and margin of error for a mean or a proportion, from summary numbers or raw data.
Formulas
Mean: x̄ ± t* · s/√n · Proportion: p̂ ± z* · √(p̂(1 − p̂)/n)
The critical value comes from the t distribution with n − 1 degrees of freedom (or the standard normal). The standard error is the standard error of the estimate. Planning a study and need a particular margin of error? Work backwards with the sample size calculator.
Frequently asked questions
What does a 95% confidence interval actually mean?
If you repeated the study many times and built an interval each time, about 95% of those intervals would contain the true value. It does not mean there is a 95% probability that this particular interval contains it; the true value is fixed, and the interval either covers it or not.
Should I use z or t?
Use t when you estimate the standard deviation from the sample, which is nearly always. Use z only when the population standard deviation is genuinely known, or for proportions. For large samples the two give almost the same answer.
How do I calculate the margin of error?
Margin of error = critical value × standard error. For a mean: t* × s/√n. For a proportion: z* × √(p̂(1 − p̂)/n). A poll of 1,000 people with p̂ = 0.5 has a 95% margin of error of about ±3.1 percentage points.
How can I make the interval narrower?
Increase the sample size (the width shrinks with √n, so four times the data halves the width), lower the confidence level, or reduce measurement noise.
What is the Wilson interval shown for proportions?
An alternative to the textbook (Wald) interval that behaves better with small samples or proportions near 0 or 1. Agresti and Coull (1998) recommend it. Your course may expect the Wald version, so both are shown.