Enter a sample mean, standard deviation and size, or a count out of a sample, for the interval, margin of error and critical value at 80 to 99.9 percent. Runs on your device.
A confidence interval for a mean is the sample mean plus or minus a critical value times the standard error: x̄ ± t* × s ÷ √n. The page opens on a sample mean of 50, a sample standard deviation of 10 and 25 values, at 95%. The standard error is 10 ÷ √25 = 2. The critical value for 24 degrees of freedom is t* = 2.0639, so the margin of error is 2.0639 × 2 = 4.13 and the interval is 45.87 to 54.13 (45.8722 to 54.1278 with four decimals). A table under the answer repeats the calculation at 80, 90, 95, 99 and 99.9%: at 99% the critical value is 2.7969 and the interval widens to 44.41 to 55.59.
Use t when the standard deviation was worked out from your sample, which is almost always. The t distribution has heavier tails than the normal curve, and the extra width depends on the degrees of freedom, n − 1. With only 5 values, t* at 95% is 2.7764 instead of 1.96; with 25 it is 2.0639; with 121 it is 1.9799. Choose z only when the population standard deviation was known before you took the sample. With the same numbers and a known σ of 10, the interval is 46.08 to 53.92, narrower than the t interval because 1.96 is smaller than 2.0639. The critical values are calculated from the Student t distribution itself, not looked up, so any sample size from 2 to 1,000,000,000 works.
For a proportion, enter how many of n had the outcome. The sample proportion is p̂ = x ÷ n. The Wald interval is the textbook p̂ ± z* × √(p̂(1 − p̂) ÷ n). For 56 out of 100 at 95% it gives 46.27% to 65.73%, a margin of error of 9.73 points. The Wilson score interval, the default here, gives 46.23% to 65.33%. They are close for a large sample and a proportion near 50%, and far apart for small counts. With 0 successes out of 20, Wald gives a width of zero, 0% to 0%, while Wilson gives 0% to 16.11%. Wilson cannot go below 0% or above 100%; a Wald interval that does is cut at the edge and the page says so. A table shows both methods side by side.
A 95% confidence level describes the method, not one interval. If you drew many random samples and built an interval from each in the same way, about 95 out of 100 of those intervals would contain the true value. It does not say there is a 95% chance this particular interval does. Raising the level to 99% widens the interval, and a larger sample narrows it: the width shrinks with the square root of n, so roughly four times as many values halves the margin of error. Levels from 80 to 99.9% are accepted. To plan how many values you need before collecting data, use the sample size calculator.
The formulas assume a random sample. For a mean they also assume the population is roughly normal, or that the sample is large enough for the average to be close to normal; heavy outliers in a small sample break this. There is no finite population correction, so for a sample that is a large share of a small population the interval is wider than it needs to be. The page does not do the difference between two means or two proportions, paired data, or a confidence interval for a standard deviation. The standard deviation must be more than 0, and a proportion needs a whole count that is no more than the sample size.
Find the standard error, s ÷ √n, multiply it by the t critical value for n − 1 degrees of freedom, and add and subtract the result from the mean. For a mean of 50, s = 10 and n = 25: 2.0639 × 2 = 4.13, so 45.87 to 54.13. Type the three numbers and the page shows each step.
Use t when the standard deviation comes from your sample. Use z only when the population standard deviation is known in advance. With n = 25 the t critical value at 95% is 2.0639 and the z value is 1.96, so ignoring the difference makes the interval about 5% too narrow. The gap closes as n grows: 1.9799 at n = 121.
The textbook Wald formula is p̂ ± z* × √(p̂(1 − p̂) ÷ n). It is unreliable for small samples or for proportions near 0% or 100%. The Wilson score interval, centre = (p̂ + z*² ÷ 2n) ÷ (1 + z*² ÷ n), is the default here because it stays between 0% and 100%. For 56 of 100 at 95% Wald gives 46.27% to 65.73% and Wilson gives 46.23% to 65.33%.
The Wilson interval is centred a little closer to 50% than the sample proportion, and the shift grows as n gets smaller. With 56 of 100 the centre is 55.78%, not 56%. With 0 of 20 the interval runs from 0% to 16.11%, so the margin of error shown is half the width and not a plus-or-minus around 0%.
Not strictly. The 95% refers to the procedure: about 95 of 100 intervals built from repeated random samples would contain the true value. Once your interval is calculated, the true value is either inside it or not. Informally, many people read it as a range of plausible values.
No. The numbers are processed in your browser and are not uploaded. They are not stored on your device either, and reloading the page puts the 50, 10 and 25 example back.