Confidence Interval Calculator

Confidence Interval Calculator

Build a confidence interval for an average from raw data or a summary, or for a proportion, and check whether a target value is consistent with your sample.

x̄ ± t × s ÷ √n

Enter your sample to build an interval

What Is a Confidence Interval?

A confidence interval is a range of plausible values for a population figure, built from a sample by a method that captures the true value a set share of the time. A 95% interval method succeeds in 95 samples out of 100.

For an average, the interval is centred on the sample mean and stretches a t multiplier times the standard error each way. The t multiplier is larger than 1.96 for small samples, because the spread itself is uncertain.

An interval doubles as a test. Values outside a 95% interval are exactly those a two-sided t-test would reject at the 5% level, which is why the optional check above is useful.

Confidence Interval Formula

As given in the NIST/SEMATECH e-Handbook, section 7.2.2.1, and Agresti & Coull (1998) for proportions. See Sources.

1. Standard error of the mean

SE = s ÷ √n

2. Interval for a mean

x̄ ± t(n − 1) × SE

3. Wilson interval for a proportion

(p̂ + z²/2n ± z√(p̂(1 − p̂)/n + z²/4n²)) ÷ (1 + z²/n)

Wilson stays inside 0–100% and keeps close to its stated coverage for small samples, where the textbook p̂ ± z√(p̂(1 − p̂)/n) falls short.

Worked Example: Are the Flour Bags Underweight?

Given:
Ten "1 kg" bags weigh 996, 1003, 991, 998, 994, 1001, 989, 997, 995, 993 g. Is 1,000 g a plausible average?
Step 1:
Summarise the sample:
x̄ = 995.7 g · s = 4.296 g · n = 10
Step 2:
Standard error and t for 9 degrees of freedom:
SE = 4.296 ÷ √10 = 1.359 · t = 2.262
Step 3:
Build the interval:
995.7 ± 2.262 × 1.359 = 995.7 ± 3.07
Result:
992.6 to 998.8 g

1,000 g sits above the whole interval, so the filling line looks set a few grams light. The table below shows a 99% interval only just reaches 1,000 g, so the evidence is strong but not overwhelming.

How the Confidence Level Changes the Interval

The flour-bag sample at each level. More confidence buys a wider net.

Confidence intervals for the flour example at four confidence levels
Levelt (df 9)Interval (g)Contains 1,000?
80%1.383993.8 to 997.6No
90%1.833993.2 to 998.2No
95%2.262992.6 to 998.8No
99%3.25991.3 to 1,000.1Yes

Common Confidence Interval Mistakes

  • Saying there's a 95% chance the true value is inside. The true value is fixed; it's either in or out. The 95% describes how often the method works.
  • Reading it as the range of individual values. The interval is for the average. Individual bags vary far more; that needs a prediction interval.
  • Using z = 1.96 for a small sample. With 10 values the t multiplier is 2.26, making the interval about 15% wider.
  • Judging overlap between two intervals. Two 95% intervals can overlap while the difference is still significant. Test the difference directly.
  • Using p̂ ± z√(p̂(1 − p̂)/n) for small counts. With 0 successes it gives an interval of zero width. Wilson handles this sensibly.

Confidence Interval FAQs

Which confidence level should I use?

95% is the convention. Use 99% when a wrong conclusion is costly, or 90% for early, exploratory work.

Why is the interval for a mean based on t?

Because s is estimated from the sample. The t distribution allows for that extra uncertainty and approaches z as n grows.

What does the data need to look like?

Roughly symmetric without extreme outliers for small samples. For 30+ values the central limit theorem makes the t interval robust.

Why does the proportion interval use Wilson?

It has more reliable coverage than the textbook (Wald) interval, especially for small samples or results near 0% or 100%. Both are shown.

How do I make the interval narrower?

Collect more data. The width falls with √n, so four times the data halves the width.

Is the interval the same as the margin of error?

The margin of error is half the interval’s width. The interval is the estimate plus and minus that margin.

Can I enter percentages for the value to check?

Yes. In proportion mode, 25%, 0.25 and 1/4 all mean the same thing.

What about a one-sided interval?

For a lower or upper bound only, use the two-sided interval at double the tail: a 90% two-sided interval gives a 95% one-sided bound.

Sources

Related Tools