Confidence Interval Calculator

A confidence interval gives a range that is likely to contain the true value, based on a sample. Use it for an average (mean) or a share (proportion).

For a
Results update as you type.

95% confidence interval

50.253181 to 54.346819

52.3 ± 2.04682

Margin of error
2.0468193
Standard error (s ÷ √n)
1.0119289
Critical t (df = 39)
2.02269

About this calculator

For a mean the calculator uses the t distribution when the standard deviation comes from the sample, which is the usual case.

How to use it

  1. Choose mean or proportion.
  2. Enter the sample results and confidence level.
  3. Read the interval and margin of error.

The formula

Mean: x̄ ± t × s ÷ √n; proportion: p̂ ± z × √(p̂(1 − p̂) ÷ n)
x̄
sample mean
s
standard deviation
n
sample size
t, z
critical value for the confidence level

Worked example

Mean 52.3, s 6.4, n 40 at 95%

  1. SE = 6.4 ÷ √40 = 1.012; t with 39 df = 2.023.
  2. Interval: 52.3 ± 2.047, or 50.25 to 54.35.

What the result means

95% confidence means that the method captures the true value in 95% of samples, not that there is a 95% chance this particular interval is right.

Worked example: a survey proportion

In a survey of 1,000 people, 420 say they would buy a product. The sample proportion is 42%. At 95% confidence the calculator gives a margin of error of 3.06 percentage points and an interval of 38.94% to 45.06%. The Wilson interval, 38.98% to 45.08%, is almost the same because the sample is large.

How sample size changes the margin

For a result of 50% at 95% confidence, which gives the widest margin, the calculator shows:

Margin of error at 95%, sample proportion 50%
Sample sizeMargin of errorInterval
100± 9.8%40.2% to 59.8%
400± 4.9%45.1% to 54.9%
1,000± 3.1%46.9% to 53.1%
2,500± 1.96%48.04% to 51.96%

Worked example: average exam marks

A sample of 50 students has a mean of 64 marks with a standard deviation of 12. The standard error is 12 ÷ √50 = 1.697. Using t with 49 degrees of freedom:

  • 90%: 61.15 to 66.85 (± 2.85).
  • 95%: 60.59 to 67.41 (± 3.41).
  • 99%: 59.45 to 68.55 (± 4.55).
  • With 200 students and the same spread, the 95% interval narrows to 62.33 to 65.67.

Assumptions

  • A random sample; roughly normal data or a sample of 30 or more for a mean.

Limitations

  • The Wald interval for proportions is poor for small samples; the Wilson interval is shown alongside.

Frequently asked questions

Should I use t or z?

Use t when the standard deviation is estimated from the sample. Use z only if the population standard deviation is genuinely known.

Why is the interval wider at 99%?

More confidence needs a wider net.

How do I make the interval narrower?

Increase the sample size: quadrupling n halves the width.

What sample size gives a 3% margin of error?

At 95% confidence and a 50% result, about 1,000 responses give a margin of about 3.1%. A margin of exactly 3% needs slightly more.

Why does the Wilson interval differ for small samples?

With 3 successes out of 30, the normal (Wald) interval runs from 0% to 20.7%, cut off at zero, while the Wilson interval is 3.46% to 25.62%. Wilson stays inside 0% to 100% and is more accurate in such cases.

Last reviewed on 6 October 2026. How we calculate and check. Found a mistake? Tell us.