Confidence Interval Calculator

Find the range that likely contains the true mean or proportion, using the t-distribution for sample standard deviations and the normal distribution for proportions.

Your results

–

Save this calculation and come back to it any time. Members only — $5 every 3 months, ad-free.

Become a member

How to use the confidence interval calculator

  1. Choose an interval for a mean (an average, such as a test score or a weight) or a proportion (a share, such as the percentage of people who said yes).
  2. For a mean, enter the sample mean, the standard deviation and the sample size. For a proportion, enter the number of successes and the sample size.
  3. Enter the confidence level. 95% is the usual choice.
  4. For a mean, keep t unless you know the population's standard deviation from outside your sample, which is rare.

The confidence interval formulas

Mean, σ unknown: x̄ ± t* × s ÷ √n (n − 1 degrees of freedom) Mean, σ known: x̄ ± z* × σ ÷ √n Proportion: p̂ ± z* × √( p̂(1 − p̂) ÷ n )

x̄ is the sample mean, s the sample standard deviation, n the sample size and p̂ the sample proportion (successes ÷ n). The part after ± is the margin of error. The critical values t* and z* are the points that leave (100% − confidence) ÷ 2 in each tail of the t or normal distribution. The calculator computes them exactly instead of looking them up, so any confidence level and any degrees of freedom work. For proportions it also shows the Wilson score interval, which behaves better when p̂ is close to 0% or 100% or the sample is small.

Worked example

The calculator starts with a sample of 40 test scores with a mean of 72.5 and a standard deviation of 10, at 95% confidence:

  • Standard error: 10 ÷ √40 = 10 ÷ 6.32456 = 1.58114
  • t* for 95% with 39 degrees of freedom: 2.02269
  • Margin of error: 2.02269 × 1.58114 = 3.19814
  • Interval: 72.5 ± 3.198 = 69.302 to 75.698

With z* = 1.95996 instead, the interval is slightly narrower: 69.401 to 75.599. At 99% confidence, t* rises to 2.70791 and the interval widens to 68.218 to 76.782.

For a proportion, 120 "yes" answers out of 400 gives p̂ = 0.3. The standard error is √(0.3 × 0.7 ÷ 400) = 0.02291, the margin of error is 1.95996 × 0.02291 = 0.04491, and the interval is 25.51% to 34.49%.

What the interval means

A 95% confidence interval comes from a method that captures the true value 95% of the time when you repeat the sampling. It does not mean there is a 95% chance that the true mean lies in this particular interval; the true mean is fixed, and this interval either contains it or doesn't. In practice, read it as the range of values that are consistent with your data.

To get a narrower interval Effect
Quadruple the sample size Halves the margin of error
Lower the confidence from 99% to 95% About 25% narrower for large samples
Reduce the variation in the data Margin falls in proportion to s

If you are planning a survey and want a particular margin of error, the sample size calculator works backwards from it.

t or z?

The t-distribution has fatter tails than the normal curve, which allows for the extra uncertainty of estimating the standard deviation from the same sample. With 5 values, t* for 95% is 2.776 instead of 1.960; with 40 values it is 2.023; with 1,000 values the two are almost identical. The t interval also assumes the data is roughly normal, which matters most for small samples: with fewer than about 30 values, look for strong skew or outliers first.

Frequently asked questions

What confidence level should I use?

95% is the standard in most fields. Use 90% for a quick, rough estimate, and 99% when a wrong conclusion would be costly. Higher confidence always means a wider interval for the same data.

What is the difference between standard deviation and standard error?

The standard deviation describes how spread out the individual values are. The standard error, s ÷ √n, describes how much the sample mean would vary from sample to sample. It shrinks as the sample grows, while the standard deviation doesn't.

When should I use the Wilson interval for a proportion?

Use it when you have fewer than about 10 successes or 10 failures, or when the proportion is near 0% or 100%. The simple interval can then run below 0% or above 100%, or have zero width when every answer is the same. The Wilson interval avoids both problems.

Can I use this for a difference between two groups?

Not directly, because comparing two groups needs a combined standard error. Intervals that don't overlap at all point to a real difference, but overlapping intervals don't prove there is none. For a formal test, use a two-sample test and the p-value calculator.

Related calculators

  • Sample Size Calculator — How many survey responses you need for a given confidence level and margin of error, or the margin for your sample.
  • Standard Deviation Calculator — Sample and population standard deviation, variance and mean of a list of numbers, with every step shown.
  • Z-Score Calculator — The z-score and percentile of a value, the probability between two values, and the value at any percentile.
  • P-Value Calculator — p-value from a z-score, t-score or chi-square statistic, one- or two-tailed, with significance at 0.05 and 0.01.

Results are calculated in your browser. Double-check anything important before you rely on it. See our disclaimer.