Confidence Interval Calculator
Intervals for a mean using Student's t and for a proportion using Wilson, with the interpretation stated plainly because it is the part everybody gets wrong.
Sample mean 100.0000
Standard deviation 15.0000
Sample size 10
Standard error 4.7434
t critical value, 9 df 2.2620
z would have been 1.9600
Margin of error ± 10.7296
95% interval 89.2704 to 110.7296
As a percentage of the mean ± 10.73%
The critical value is 2.2620 from Student's t at 9 degrees of freedom,
not the 1.960 from the normal distribution. Using z here would make the
interval 13.4% narrower than the sample supports, and at a handful of
observations the gap is much larger: at two observations t is 12.7.
A 95 percent interval does not mean a 95 percent chance that the true
mean is between 89.2704 and 110.7296. The true mean is fixed; the
interval is what varies from sample to sample. It means that this
procedure, repeated on many samples, produces an interval containing the
true mean 95 percent of the time.
The margin shrinks with the square root of the sample size, so halving
it takes four times the data: 40 observations rather than 10. That is
the whole cost conversation about sample size in one line.
This assumes the observations are independent and roughly symmetric. For
strongly skewed data, such as revenue per customer or time on page, the
mean is a poor summary to begin with and a bootstrap interval on the
median is the better answer.
Check what you put in the deviation field. The standard deviation
describes the spread of the observations; the standard error describes
the spread of the mean and is already divided by the root of n. Putting
the error in gives an interval that is too narrow by exactly that
factor.
Output is valid and updates as you type.
Fix the highlighted fields to update the output.
A 95 percent confidence interval does not mean there is a 95 percent chance the true value is inside it.
The true value is fixed. The interval is the thing that varies from sample to sample. What the 95 percent describes is the procedure: repeated on many samples, it produces intervals that contain the true value 95 percent of the time. That distinction sounds academic until somebody uses the first reading to claim a 95 percent probability that their change worked.
Two arithmetic points also matter, and most calculators quietly take the convenient answer.
For a mean from a small sample the critical value comes from Student’s t, not the normal distribution. At nine degrees of freedom t is 2.262 against z’s 1.96, so using z makes the interval about 13 percent narrower than the data supports.
For a proportion, the textbook p ± z·√(p(1−p)/n) fails at small counts and can return a
bound below zero. Wilson’s interval cannot, and it is what this uses.
How to use
- Pick a mean or a proportion.
- For a mean, put in the mean, the standard deviation of the observations, and the sample size. For a proportion, the count and the sample size.
- Read the interval, and the note about what it means.
Example
A mean of 100, standard deviation 15, ten observations:
Standard error 4.7434
t critical value, 9 df 2.2620
z would have been 1.9600
Margin of error ± 10.7296
95% interval 89.2704 to 110.7296
And a proportion, two successes out of forty:
95% interval, Wilson 1.382% to 16.504%
The textbook interval, for comparison
p ± z·√(p(1−p)/n) -1.754% to 11.754% ← below zero, which is not a proportion
That negative bound is not an edge case. It happens whenever the count is small or the rate is near either end, which describes most conversion data.
Pitfalls
The interpretation. Not “a 95 percent chance the true value is in here”. The interval either contains the true value or it does not; the 95 percent is a property of the method.
Standard deviation, not standard error. The deviation describes the spread of the observations. The error describes the spread of the mean and is already divided by the root of the sample size. Putting the error in the deviation field reports an interval that is too narrow by exactly that factor, and the tool refuses a deviation of zero partly to catch it.
Use t for a mean. At small samples the difference is large: at two observations t is 12.706. The tool prints what z would have been so the gap is visible.
Between table rows it rounds the wrong way on purpose. At 35 degrees of freedom it uses the value for 30, which is larger, so the interval is slightly wider. Rounding the other way would report more precision than the sample supports.
A wide interval is information. It says the sample is too small to answer the question. That is a useful finding, not a failure of the calculation, and it is the honest thing to report when somebody asks for a single number.
Four times the data halves the margin. The margin shrinks with the square root of the sample size. That is the whole cost conversation about sample size, and it is why going from 1,000 to 1,100 observations changes nothing you can see.
Skewed data needs a different tool. Revenue per customer and time on page are strongly skewed, so the mean is a poor summary to start with and a t interval on it is precise about the wrong quantity. A bootstrap interval on the median is the better answer there.
Compatibility
Arithmetic in the browser: nothing is uploaded and nothing is stored.
The t critical values are the published table for 1 to 30 degrees of freedom and then 40, 50, 60, 80, 100 and 120, at 90, 95 and 99 percent, two sided. Past 120 the distribution is within a rounding error of the normal, so it uses z. A table rather than an approximation, because the approximations are worst exactly where t matters.
The proportion interval is Wilson’s score interval, which is the one recommended in the statistics literature for small samples and is what the other rate tools on this site use. The textbook interval is printed next to it so the difference is visible rather than asserted.
Both assume the observations are independent and identically distributed: counted once, drawn at random, from the same population. That assumption is broken more often than the arithmetic is wrong, and no formula repairs it.
Frequently asked questions
Which confidence level should I use?
How do I get the standard deviation?
STDEV.S, and STDEV.P is the population version, which is the wrong one
for a sample.