Confidence Interval Calculator
Intervals for means, proportions and their differences, with margin of error and working.
Try before you buy.
- Free preview: a watermarked chart of the interval and the names of each table’s first rows (up to 3), with the interval, the working and every figure hidden.
- Locked until you unlock it: download and copy.
- Unlock: Pro pass, ₹179 for 30 days, a one-time payment that never renews.
Ways to unlock shows how to get the full result.
Printing this result is locked in the free preview.
Result
This is the last result worked out. Fix the input above to update it.
Locked in the free preview. Opens the ways to unlock this result.
Locked in the free preview. Batch runs unlock with a pass.
Locked in the free preview. Query results unlock with a pass.
About the Confidence Interval Calculator
Work out a confidence interval — or a one-sided confidence bound — for a mean, a proportion, the difference between two means, the difference between two proportions or a standard deviation, from raw data or from summary statistics. You get the interval, the margin of error, the standard error, the critical value (t, z or χ²), the working step by step and a plain-language interpretation.
For proportions, where the textbook formula is known to fail with small samples or rates near 0 % or 100 %, the calculator shows every common method side by side — Wilson’s score interval, the Clopper–Pearson exact interval, Jeffreys, Agresti–Coull and Wald — on one chart, so you can see how much the choice matters for your numbers. Two proportions get Newcombe’s hybrid score interval, Agresti–Caffo and Wald.
How to use it
- Choose what the interval is for: a mean, a proportion, two means, two proportions or a standard deviation.
- Type the summary statistics (mean, standard deviation and sample size), paste the raw data, or type the number of successes and the number of trials for a proportion.
- Set the confidence level — 95 % is usual — and choose a two-sided interval or a one-sided lower or upper bound. For proportions, pick the method (Wilson is a safe default).
- Read the interval, the margin of error and the working; the chart shows the interval on the sampling distribution, or all the methods for a proportion.
- Copy the result or download a CSV file or the chart — with a Pro pass or after unlocking this result; without one you see the free preview.
Examples
n = 195, x̄ = 9.261460, s = 0.022789, 95 %
9.261460 ± 0.0032187 = [9.258241, 9.264679], with t = 1.9723 (194 df)
The e-Handbook works from the raw data and prints the lower limit as 9.258242; from the rounded summary values it is 9.258241.
4 defects in 20 parts, 90 %, Clopper–Pearson
[0.071354, 0.401028]
The NIST/SEMATECH e-Handbook’s exact binomial example, which prints the upper limit as 0.401029 (it is 0.4010281). Wilson gives [0.093118, 0.378377] at the same level.
26 of 200 (13 %), 95 % lower bound, Wilson
p ≥ 0.095773
The e-Handbook’s example: the defect rate is at least 9.58 %.
56 of 70 against 48 of 80, 95 %, Newcombe
p₁ − p₂ = 0.2, interval [0.052431, 0.333873]
Newcombe’s own worked example; the Wald interval is [0.057505, 0.342495].
Student’s sleep data: drug 1 against drug 2
x̄₁ − x̄₂ = −1.58, 95 % interval [−3.36548, 0.205483] with 17.78 df
n = 100, s = 0.0063, 95 %
σ between 0.0055314 and 0.0073186
From the χ² quantiles 73.361 and 128.422 with 99 degrees of freedom.
Common uses
- Reporting a survey result with its margin of error, or a conversion or defect rate with an honest range.
- Giving the precision of an average from a sample — a lab measurement, a sales figure, a test score.
- Showing how large a difference between two groups or two rates plausibly is, not just whether it is significant.
- Checking homework and textbook intervals, including the exact and score intervals that tables do not give.
The formulas
- Mean, σ unknown (t interval): x̄ ± t·s/√n, with t from Student’s t distribution with n − 1 degrees of freedom (NIST e-Handbook). With a known population σ: x̄ ± z·σ/√n.
- Two means: (x̄₁ − x̄₂) ± t·√(s₁²/n₁ + s₂²/n₂) with Welch’s degrees of freedom, or the pooled version when the variances are assumed equal.
- Standard deviation: √((n − 1)s²/χ²_upper) ≤ σ ≤ √((n − 1)s²/χ²_lower), with the χ² quantiles for n − 1 degrees of freedom.
- Proportion, Wilson score: [p̂ + z²/(2n) ± z·√(p̂(1 − p̂)/n + z²/(4n²))] / (1 + z²/n) (Wilson); Clopper–Pearson: the beta quantiles B(α/2; x, n − x + 1) and B(1 − α/2; x + 1, n − x) (Clopper and Pearson); Jeffreys: the quantiles of Beta(x + ½, n − x + ½); Agresti–Coull: the Wald formula on (x + z²/2)/(n + z²); Wald: p̂ ± z·√(p̂(1 − p̂)/n).
- Two proportions, Newcombe: combines the Wilson limits (l₁, u₁) and (l₂, u₂) of each group: d − √((p̂₁ − l₁)² + (u₂ − p̂₂)²) to d + √((u₁ − p̂₁)² + (p̂₂ − l₂)²) (Newcombe).
For a 95 % two-sided interval the critical value leaves 2.5 % in each tail (z = 1.96); a one-sided 95 % bound uses z = 1.645, or the matching t.
Which interval for a proportion?
The Wald interval p̂ ± 1.96·√(p̂(1 − p̂)/n), still the one in many textbooks, covers the true proportion less often than it claims — badly so for small samples and for rates near 0 or 1, and it gives a zero-width interval when there are no successes. Brown, Cai and DasGupta recommend the Wilson or Jeffreys interval for small samples and Agresti–Coull for larger ones. Clopper–Pearson is called exact because it never covers less often than the stated level; the price is a wider, conservative interval. The NIST/SEMATECH e-Handbook also prefers the Wilson interval to the normal approximation.
What “95 % confident” means
The method, not the single interval, has the 95 % property: if you repeated the study many times and built an interval each time, about 95 % of those intervals would contain the true value. A particular interval either contains it or not — so it is not right to say there is a 95 % probability that the true mean lies in this interval. A wider interval means less precision: it shrinks with the square root of the sample size, so halving the margin of error takes four times as many observations.
Margin of error and one-sided bounds
For symmetric intervals the margin of error E is the half-width: the estimate ± E. Score and exact intervals for proportions are not symmetric around p̂, which is part of why they are more accurate near 0 and 1, so the calculator gives their limits rather than a margin. A one-sided bound puts the whole α in one tail — “the defect rate is at most 2.4 %” — and is what specifications and safety limits usually need.
Limitations
- Intervals for means assume independent observations and, for small samples, roughly normal data; the interval for a standard deviation relies on normality strongly, whatever the sample size.
- Proportion intervals assume independent trials with the same probability of success — a random sample, not a convenience sample.
- Raw data can have up to 100,000 values; summary statistics up to 10,000,000 observations per group.
- Paired data (before and after on the same subjects) need an interval for the mean of the differences: work out the differences and use the mean mode, or use the paired t-test.
Privacy
Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.
Frequently asked questions
What do I get without a pass?
Without a pass, Confidence Interval Calculator shows a watermarked chart of the interval and the names of each table’s first rows (up to 3), with the interval, the working and every figure hidden. Until you unlock it, the result can’t be downloaded or copied. A Pro, Premium or Ultimate pass, a one-time payment that never renews, unlocks the full result. The pricing page lists the passes and their prices.
How do I calculate a 95 % confidence interval for a mean?
Take the sample mean, the standard deviation and the sample size, and work out x̄ ± t·s/√n, where t comes from the t distribution with n − 1 degrees of freedom (2.262 for n = 10, 2.045 for n = 30, about 1.96 for large n). For x̄ = 50, s = 10 and n = 25 that is 50 ± 2.064 × 2 = [45.87, 54.13].
When should I use z instead of t?
Use z only when the population standard deviation σ is known — rare outside textbook exercises and long-running processes. When σ is estimated from the sample, use t; for large samples the two are almost the same (t = 1.984 against z = 1.960 with 100 degrees of freedom).
What is the margin of error of a poll?
For a proportion it is about z·√(p̂(1 − p̂)/n): with 1,000 respondents and a result near 50 % it is 1.96 × √(0.25/1000) ≈ 3.1 percentage points at 95 %. It covers only random sampling error, not the effects of who chose to answer or how questions were worded.
What if I observed 0 successes?
The Wald interval is then 0 to 0, which is wrong. The exact Clopper–Pearson upper limit with 0 successes in n trials is 1 − (α/2)^(1/n), and the “rule of three” gives about 3/n as a one-sided 95 % upper bound: 0 events in 30 trials still allow a rate of up to about 10 %.
Why is the Clopper–Pearson interval wider than the others?
It guarantees at least the stated coverage for every true proportion, and because a count can only take whole values it usually covers more often than that, which makes it conservative. Wilson and Jeffreys intervals aim at the stated coverage on average instead, so they are shorter.
Does an interval for the difference that includes 0 mean there is no difference?
It means the data are compatible with no difference at that confidence level — the matching two-sided test is not significant — but also with every other value in the interval. A wide interval that includes 0 says the study cannot tell, not that the groups are the same.