About this tool
A confidence interval gives a range of plausible values for a population quantity, such as an average or a share, based on a sample. Its width shows how precise the estimate is: the margin of error is half the width.
The confidence level describes the method, not one particular interval. If you repeated the sampling many times, about 95 % of the 95 % intervals built this way would contain the true value. Higher confidence or more variable data make the interval wider; a larger sample makes it narrower.
How it works
For a mean, enter the sample mean, the sample size and the standard deviation, or paste the raw data and let the calculator work them out. If the population standard deviation is known, the interval uses the z distribution; otherwise it uses Student's t with degrees of freedom, which is the usual case.
For a proportion, enter the number of successes and the sample size. The calculator shows the Wilson score interval, which is recommended, and the simpler Wald interval for comparison. Choose a confidence level of 80 % to 99 %, or a custom level, to see the critical value, the margin of error and the interval.
Example
Ten measurements have a mean of 50 and a sample standard deviation of 8. The standard error is , and for 95 % confidence with 9 degrees of freedom . The margin of error is , so the interval is , from about 44.28 to 55.72.
In a survey, 81 of 263 people agree, so . The 95 % Wilson interval runs from about 25.5 % to 36.6 %; the Wald interval, from about 25.2 % to 36.4 %, is similar because the counts are large.
Assumptions and limits
The intervals assume a random sample of independent observations. The t interval for a mean also assumes the data are roughly normal, which matters most for small samples; with 30 or more observations it is usually robust unless the data are strongly skewed or have outliers.
The Wald interval for a proportion is unreliable when there are fewer than about 10 successes or 10 failures, and it can extend below 0 % or above 100 %. The Wilson interval keeps better coverage in those cases. No interval accounts for biased sampling, non-response or measurement error.
Frequently asked questions
Should I use z or t?
Use t whenever the standard deviation comes from your sample, which is almost always. Use z only when the population standard deviation is genuinely known, for example from a long-running process. For large samples the two give nearly the same interval.
Why is the Wilson interval recommended for proportions?
The Wald interval often covers the true proportion less often than its stated level, especially for small samples or proportions near 0 or 1, and it collapses to zero width when there are no successes. The Wilson score interval keeps close to the stated coverage and always stays between 0 and 1.
What does 95 % confidence mean?
It means that 95 % of intervals produced by this method would contain the true value. It does not mean there is a 95 % probability that the true value lies in this particular interval, which either contains it or does not.
How can I make the interval narrower?
Increase the sample size: the margin of error shrinks with , so quadrupling the sample halves it. A lower confidence level also narrows the interval, at the cost of being wrong more often. Use the sample size calculator to plan the sample for a target margin of error.
Which standard deviation should I enter?
For the t interval, enter the sample standard deviation , computed with in the denominator. If you paste raw data, the calculator computes it for you.
Link with your values
Add these parameters to this page’s address to open it with the values filled in, for example to share a calculation or to link to it from an AI assistant. The result is calculated in the browser: the page HTML shows an example for the default values, and the tool sets the data-url-params attribute once the link’s values are applied.
| Parameter | Value | If omitted |
|---|---|---|
kindEstimate | one of: mean, proportion | default mean |
sourceData entry | one of: summary, data; used with kind = mean | default summary |
sigmaStandard deviation | one of: unknown, known; used with kind = mean | default unknown |
meanSample mean (x̄) | number; used with kind = mean; used with source = summary | required |
nSample size (n) | whole number; allowed ≥ 1; used with kind = mean; used with source = summary | required |
sdSample standard deviation (s) | number; allowed ≥ 0; used with kind = mean; used with source = summary; used with sigma = unknown | required |
population_sdPopulation standard deviation (σ) | number; allowed ≥ 0; used with kind = mean; used with sigma = known | required |
valuesSample values | values separated by commas: 2,4,4,6; used with kind = mean; used with source = data | required |
successesSuccesses (x) | whole number; allowed ≥ 0; used with kind = proportion | required |
totalSample size (n) | whole number; allowed ≥ 1; used with kind = proportion | required |
confidence_level_pctConfidence level | percent: 6.5 means 6.5%; allowed > 0 – < 100 | default 95 |
Examples
?mean=72.4&sd=6.1&n=36&confidence_level_pct=99?values=12.1,11.8,12.4,12.0,11.9,12.3&population_sd=0.25?successes=412&total=1000
Write decimals with a point. Encode a space as %20, + as %2B, # as %23 and & as %26.
Result elements: [data-result-block="confidence_interval_calculator"]