100+ free calculators - no signup, no ads | 💰 Financial ❤️ Health & Fitness 📐 Math 🔧 Other
🇺🇸 USD | About Contact

Confidence Interval Calculator

Mean (t or z) · Raw data · Proportion · Sample size

x̄ ± t × s ÷ √n

📏 Enter a mean, raw data, or a count of successes to see the interval and margin of error.

What Is a Confidence Interval?

A confidence interval is a range, built from sample data, that estimates an unknown population value such as a mean or a proportion. It has the form estimate ± margin of error. A sample of 15 people with a mean of 8.23 might give a 95% interval of (7.30, 9.15).

The confidence level describes the method, not one interval. If you drew many samples and built a 95% interval from each, about 95% of them would contain the true mean. A single interval either contains it or does not, so it is not correct to say there is a 95% probability that the true mean is inside (7.30, 9.15). A narrow interval signals a precise estimate; a wide one signals more uncertainty.

How to Use the Confidence Interval Calculator

  1. Mean: enter x̄, n, and the standard deviation. Choose "Sample s" when the SD was calculated from your data (t interval) or "Known σ" when it comes from a reliable outside source (z interval).
  2. Raw data: paste your values. The calculator finds n, x̄, and s, then builds the t interval.
  3. Proportion: enter the number of successes and the sample size. You get the Wilson interval and the simpler Wald interval.
  4. Sample size: enter the margin of error you want and an estimate of σ or p to see how many observations you need.

Set the confidence level once at the top; it applies to every tab. Enter a test value to see whether a claimed mean or proportion falls inside the interval. For a proportion, a test value such as 10 is read as 10%.

Confidence Interval Formulas

Mean, σ unknown: x̄ ± t × s ÷ √n x̄ = 8.2267, s = 1.6722, n = 15, df = 14, t = 2.1448 SE = 1.6722 ÷ 3.873 = 0.4318; E = 2.1448 × 0.4318 = 0.9260 CI = (7.3007, 9.1527)
Mean, σ known: x̄ ± z × σ ÷ √n x̄ = 68, σ = 3, n = 36, 90%: z = 1.645, SE = 0.5 E = 0.8225; CI = (67.18, 68.82)
Proportion (Wald): p̂ ± z√(p̂(1 − p̂) ÷ n) x = 26, n = 200: p̂ = 0.13, SE = 0.02378 E = 1.96 × 0.02378 = 0.0466; CI = (0.0834, 0.1766)
Sample size: n = (z × σ ÷ E)² σ = 15, E = 3, 95%: (1.96 × 15 ÷ 3)² = 96.04, round up to 97

Critical Values for Common Confidence Levels

The critical value sets how many standard errors the interval extends on each side. For t, it depends on the degrees of freedom, n − 1, so a sample of 15 uses the df 14 value of 2.145 at 95%.

Levelzt, df 5t, df 10t, df 30
80%1.2821.4761.3721.310
90%1.6452.0151.8121.697
95%1.9602.5712.2282.042
98%2.3263.3652.7642.457
99%2.5764.0323.1692.750

A 95% interval leaves 2.5% in each tail, so it uses the 97.5th percentile of the distribution. The calculator computes t for any df, so no table lookup is needed.

How to Calculate a Confidence Interval Manually

  1. Find the point estimate: the sample mean x̄ or the proportion p̂ = x ÷ n.
  2. Find the standard error: s ÷ √n for a mean, √(p̂(1 − p̂) ÷ n) for a proportion.
  3. Find the critical value: α = 1 − confidence level, then look up t or z at 1 − α ÷ 2.
  4. Multiply to get the margin of error: E = critical value × SE.
  5. Subtract and add: lower = estimate − E, upper = estimate + E.

Keep full precision until the last step. Rounding t to 2.14 and SE to 0.43 in the example above gives E = 0.92 instead of 0.926, which shifts both limits.

Worked Scenarios

Survey margin of error. A poll of 1,068 adults finds 52% support for a proposal. The 95% margin is 1.96 × √(0.52 × 0.48 ÷ 1,068) = 0.030, so the interval is 49% to 55%. Because 50% lies inside, the poll cannot show majority support at the 95% level.

Quality control. A filling line targets 500 ml. A sample of 25 bottles has x̄ = 498.6 ml and s = 2.5 ml. With df = 24, t = 2.064, SE = 0.5, and E = 1.032, so the 95% interval is 497.57 to 499.63 ml. The target lies outside, which suggests the line is underfilling.

Planning a study. To estimate mean commute time within ±2 minutes at 95% confidence, with σ estimated at 12 minutes from a pilot, n = (1.96 × 12 ÷ 2)² = 138.3, so survey at least 139 people.

What Makes an Interval Wider or Narrower

  • Larger sample: narrower, because the margin shrinks with √n. Four times the sample halves the margin.
  • Larger SD: wider, in direct proportion.
  • Higher confidence: wider. Moving from 95% to 99% changes z from 1.960 to 2.576, about 31% wider.

Wilson vs Wald for Proportions

The Wald interval p̂ ± z√(p̂(1 − p̂) ÷ n) is the one in most textbooks, but it can give a lower limit below 0 or an upper limit above 1 when p̂ is near 0 or 1 or n is small. With 0 successes it collapses to a width of zero.

The Wilson score interval inverts the z test for a proportion, always stays between 0 and 1, and is recommended by NIST for nearly all combinations of n and p. This calculator shows Wilson as the main result and Wald for comparison. For large samples with p̂ near 0.5 the two agree closely.

Common Mistakes and Limitations

  • Using z with an estimated SD. If s comes from your sample, use t. With n = 15, z gives a margin about 9% too narrow.
  • Confusing SD with standard error. The interval uses s ÷ √n, not s. Using s alone makes the interval √n times too wide.
  • Reading overlap as a test. Two intervals can overlap slightly while the difference between the groups is still significant. Compare groups with a two sample test or an interval for the difference.
  • Non random samples. The formulas only account for random sampling error. Bias from a convenience sample, nonresponse, or measurement error is not included.
  • Reporting too many decimals. Round the final limits to one or two more decimals than the original data. A mean of 8.2 from data recorded to one decimal should not be reported as 8.226667.
  • Very skewed data with small n. The t interval assumes the sample mean is roughly normal. For a small, strongly skewed sample, consider a transformation or a bootstrap interval.

A test value inside a 95% interval means the data do not reject that value in a two sided test at α = 0.05; a value outside means they do.

Frequently Asked Questions

What is a confidence interval?
A range from sample data that estimates a population value, written as estimate ± margin of error. The confidence level, usually 90%, 95%, or 99%, is how often the method captures the true value over repeated samples.
How do you calculate a 95 percent confidence interval?
Use x̄ ± t × s ÷ √n with t at 0.975 and n − 1 degrees of freedom. For x̄ = 8.2267, s = 1.6722, and n = 15, that is 8.2267 ± 0.926 = (7.30, 9.15). Use z = 1.960 when σ is known.
What does a 95 percent confidence interval mean?
About 95% of intervals built the same way from repeated samples contain the true value. It is a statement about the method, not a 95% probability for one particular interval.
How do you calculate the margin of error?
Critical value × standard error: t × s ÷ √n for a mean, z × √(p̂(1 − p̂) ÷ n) for a proportion. A poll with p̂ = 0.5 and n = 1,068 has a 95% margin of about ±3 points.
When should you use a t interval instead of a z interval?
Whenever the SD is estimated from the sample. Use z only for a known σ and for proportions. With df = 14, t = 2.145 versus z = 1.960 at 95%; by df = 100 the gap is under 2%.

Sources & References

  • NIST/SEMATECH. Engineering Statistics Handbook, 1.3.5.2 Confidence Limits for the Mean itl.nist.gov
  • NIST/SEMATECH. Engineering Statistics Handbook, 7.2.4.1 Confidence Intervals itl.nist.gov
  • OpenStax. Introductory Statistics 2e, 8.1 A Single Population Mean using the Normal Distribution openstax.org
  • OpenStax. Introductory Statistics 2e, 8.2 A Single Population Mean using the Student t Distribution openstax.org

Results are for educational purposes and assume random sampling. Methodology reviewed: 2026.