A/B tests · For studentsConfidence interval calculator
An online confidence interval solved step by step: for a proportion, Wilson, Clopper–Pearson and Wald side by side, with an explanation of where the simple formula breaks; for a mean, a t-interval from data or a summary; the survey margin of error and how many people to survey for the precision you need. Levels of 90, 95 or 99%, Python and R code.
Your numbers stay in the browser and are never sent anywhere
A share of successes: conversion, defect rate, share answering “yes”. Three methods side by side, Wilson by default.
A sample mean: the t-interval accounts for the spread being estimated from the data too. From the numbers themselves or from a summary: mean, SD and n.
The survey margin for the worst case, a 50% share: what precision a given sample gives and how many people to survey for the one you need.
Numbers separated by spaces, semicolons, “, ” or new lines — you can paste a column from Excel.
A range that most likely contains the true value of a proportion or a mean. It is built from a sample, and the more data, the narrower it is. For example, 45 satisfied customers out of 50 surveyed is 90%, but about all customers you can only say “78.6 to 95.7%” at the 95% level. A single number without an interval hides how imprecise it is.
The simple Wald interval, the proportion plus or minus z standard errors, breaks near the edges and with small counts. For 45 of 50 it reaches 98.3% instead of Wilson's 95.7%, and with 0 successes of 30 it has zero width, as if the proportion were exactly zero. Wilson is correct for any proportion, and the exact Clopper–Pearson interval is slightly wider: 78.2 to 96.7%.
For the worst case, a proportion near 50%, the margin is z · √(0.25 / n), where z = 1.96 at the 95% level. For 1,000 people surveyed that is ±3.1%, for 2,000 ±2.2%, for 100 ±9.8%. The reverse task: to get ±3%, survey 1,068 people. The formula holds for a random sample; it does not fix a biased mix of respondents.
It is the reliability of the method, not a probability for one interval. If you drew many new samples and built the interval the same way, it would cover the true value in 95 cases out of 100. You cannot say of an interval already built that “the truth is inside with 95% probability”: it either is or is not. A 99% level gives a wider interval, 90% a narrower one.
Use a t-interval: the mean plus or minus the critical t times the standard error s / √n. It is wider than the normal one because the spread is estimated from the same data, and the smaller n, the more so. For 12, 15, 11, 14, 13 the mean is 13, s = 1.58, t = 2.776 at df = 4, and the interval runs from 11.04 to 14.96. From a summary it works the same way.
Increase the sample or lower the confidence level. The width falls as 1 / √n: four times the data gives an interval half as wide. A survey of 1,000 people gives ±3.1%, of 4,000 ±1.55%. Going from 95 to 90% narrows the interval by about 16%, but such an interval is wrong twice as often. For a mean, a smaller spread also helps: clean out data-entry errors.