Confidence Interval Calculator

Your values

Estimate
Standard deviation
Data entry
Confidence level (%)

Result

Lower bound

Upper bound

About 95% of intervals built this way contain the true mean.

Margin of error (E)
Critical value t* (df 9)
2.2622
Standard error
2.5298

Step by step

  1. Standard error of the mean
    SE=sn=810≈2.5298SE=\frac{s}{\sqrt{n}}=\frac{8}{\sqrt{10}}\approx2.5298
  2. Critical value from Student's t with n − 1 degrees of freedom
    t9∗≈2.2622t^*_{9}\approx2.2622
  3. Margin of error
    E=t9∗×SE≈5.7229E=t^*_{9}\times SE\approx5.7229
  4. Confidence interval
    xˉ±E=50±5.7229\bar{x}\pm E=50\pm5.7229

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 σ\sigma is known, the interval uses the z distribution; otherwise it uses Student's t with n−1n - 1 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.

xˉ±tn−1∗sn\bar{x}\pm t^*_{n-1}\frac{s}{\sqrt{n}}

Example

Ten measurements have a mean of 50 and a sample standard deviation of 8. The standard error is SE=8/10≈2.530SE = 8/\sqrt{10} \approx 2.530, and for 95 % confidence with 9 degrees of freedom t∗≈2.262t^* \approx 2.262. The margin of error is E=2.262×2.530≈5.72E = 2.262 \times 2.530 \approx 5.72, so the interval is 50±5.7250 \pm 5.72, from about 44.28 to 55.72.

In a survey, 81 of 263 people agree, so p^≈0.308\hat{p} \approx 0.308. 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 p^±z∗p^(1−p^)/n\hat{p} \pm z^*\sqrt{\hat{p}(1 - \hat{p})/n} 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 1/n1/\sqrt{n}, 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 ss, computed with n−1n - 1 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.

ParameterValueIf omitted
kindEstimateone of: mean, proportiondefault mean
sourceData entryone of: summary, data; used with kind = meandefault summary
sigmaStandard deviationone of: unknown, known; used with kind = meandefault unknown
meanSample mean (x̄)number; used with kind = mean; used with source = summaryrequired
nSample size (n)whole number; allowed ≥ 1; used with kind = mean; used with source = summaryrequired
sdSample standard deviation (s)number; allowed ≥ 0; used with kind = mean; used with source = summary; used with sigma = unknownrequired
population_sdPopulation standard deviation (σ)number; allowed ≥ 0; used with kind = mean; used with sigma = knownrequired
valuesSample valuesvalues separated by commas: 2,4,4,6; used with kind = mean; used with source = datarequired
successesSuccesses (x)whole number; allowed ≥ 0; used with kind = proportionrequired
totalSample size (n)whole number; allowed ≥ 1; used with kind = proportionrequired
confidence_level_pctConfidence levelpercent: 6.5 means 6.5%; allowed > 0 – < 100default 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"]