Estimate ± margin of error

Confidence interval calculator

A confidence interval is estimate ± critical value × standard error. A sample of 30 with mean 74.2 and SD 8.5 gives a 95% interval of 71.03 to 77.37 (t* = 2.045); a poll where 540 of 1,000 said yes gives 50.9% to 57.1%.

Final Grade Calculator editorial teamUpdated 6 sources

Calculator

Confidence interval calculator

Mean (t or z), mean from raw data, or a proportion

What are you estimating?

Your numbers

71.026 to 77.374

95% confidence interval for the mean

74.2 ± t* × SE = 74.2 ± 3.174

Margin of error
±3.174
Critical value t* (df 29)
2.0452
Standard error s ÷ √n
1.5519
Uses
t (σ unknown)

How it works. Mean: x̄ ± t* × s ÷ √n with n − 1 degrees of freedom (z* when σ is known). Proportion: p̂ ± z* × √(p̂(1 − p̂) ÷ n), with the Wilson score interval alongside.

How to calculate a confidence interval

To calculate a confidence interval, take your estimate and add and subtract the margin of error: a critical value for your confidence level times the standard error.[1]

mean: x̄ ± t* × s ÷ √n · proportion: p̂ ± z* × √(p̂(1 − p̂) ÷ n)t* has n − 1 degrees of freedom. Use z* instead of t* only when the population SD σ is known.

Worked example: a mean

n = 30, x̄ = 74.2, s = 8.5, 95% confidence. Standard error = 8.5 ÷ √30 = 1.5519. With 29 degrees of freedom, t* = 2.0452.[5]

Margin of error = 2.0452 × 1.5519 = 3.174. Interval: 74.2 ± 3.17 = 71.03 to 77.37.

Worked example: a proportion

540 of 1,000 people said yes, so p̂ = 0.54. Standard error = √(0.54 × 0.46 ÷ 1000) = 0.0158; z* = 1.96; margin = 0.0309, about ±3.1 points.[3] The 95% interval is 50.9% to 57.1%.

Critical values by confidence level

Higher confidence means a larger critical value and a wider interval. The t critical value is larger than z for small samples and moves toward it as n grows.[5][6]

Two-sided critical values
Confidencez*t*, n = 10t*, n = 30t*, n = 100
80%1.2821.3831.3111.29
90%1.6451.8331.6991.66
95%1.962.2622.0451.984
98%2.3262.8212.4622.365
99%2.5763.252.7562.626
99.9%3.2914.7813.6593.392

t or z: which interval for a mean?

Use the t interval whenever you estimate the spread from the sample itself, which is almost always.[2] The z interval assumes the population standard deviation σ is known in advance, which happens mainly in textbook exercises and in long-running processes with a known spread. For small samples the t interval also assumes the data come from a roughly normal population; check for strong skew or outliers with the statistics calculator.

Proportions: the Wald and Wilson intervals

The textbook interval for a proportion (called the Wald interval) works when there are enough successes and failures; with small counts it can be badly off, and it can even run below 0% or above 100%.[3][4] OpenStax requires more than five successes and five failures; many courses ask for at least ten. The calculator always prints the Wilson score interval as well, which Brown, Cai and DasGupta recommend for small n.[4] For 3 successes in 20 trials, the Wald interval is 0% to 30.6%, the Wilson interval 5.2% to 36%.

What “95% confidence” meansIf you repeated the sampling many times and built an interval each time, about 95% of those intervals would contain the true value. It is a statement about the method, not a 95% chance that this particular interval is right.

Common confidence interval mistakes

  • Using z* with a small sample and s. Use t* with n − 1 degrees of freedom.
  • Using the SD instead of the standard error. Divide s by √n first.
  • Reading overlap as “no difference”. Two intervals can overlap while the difference is still significant; test the difference with the t-test calculator.
  • Typing a percent as a proportion. Enter successes and the sample size; the calculator does the division.

Related: the p-value calculator and the z-score calculator.

How we check this calculator

Tests check the critical values against NIST tables (t* = 2.228139 for 10 df, 2.756386 for 29 df at 99%), the worked mean example (t* = 2.063899 for n = 25, margin 4.127797) and the Wilson interval for 8 of 10 (0.4902 to 0.9433).[5]

  • 14 November 2026: page and calculator published.

More statistics calculators

Frequently asked questions

How do you calculate a 95% confidence interval?

Mean ± t* × (s ÷ √n), with t* from the t distribution at n − 1 degrees of freedom (1.96 for z). For n = 30, mean 74.2 and SD 8.5: 74.2 ± 3.17.

What is the margin of error?

Half the width of the interval: the critical value times the standard error. A poll of 1,000 people has a margin of error of about ±3 percentage points at 95% confidence.

How does sample size change the interval?

The standard error shrinks with √n, so four times the sample gives an interval about half as wide.

When should I use the Wilson interval?

Whenever the number of successes or failures is small, or p̂ is close to 0% or 100%. It stays inside 0–100% and has coverage closer to the stated level.

Can I get a confidence interval from raw data?

Yes. Choose “A mean, from raw data” and paste the numbers; the calculator finds the mean, the sample SD and n, then builds the t interval.

Sources

  1. 1.3.5.2 Confidence Limits for the Mean · NIST/SEMATECH e-Handbook of Statistical Methods, 2012 edition (DOI 10.18434/M32189)
  2. Introductory Statistics 2e, 8.2 A Single Population Mean using the Student t Distribution · OpenStax, Rice University, 2nd edition, 2023
  3. Introductory Statistics 2e, 8.3 A Population Proportion · OpenStax, Rice University, 2nd edition, 2023
  4. Interval Estimation for a Binomial Proportion (Brown, Cai and DasGupta) · Statistical Science 16(2), 2001
  5. 1.3.6.7.2 Critical Values of the Student’s t Distribution · NIST/SEMATECH e-Handbook of Statistical Methods, 2012 edition (DOI 10.18434/M32189)
  6. 1.3.6.7.1 Cumulative Distribution Function of the Standard Normal Distribution · NIST/SEMATECH e-Handbook of Statistical Methods, 2012 edition (DOI 10.18434/M32189)