Skip to content

Confidence Interval Calculator — Step-by-Step Solutions

The Confidence Interval Calculator computes confidence intervals for population means and proportions. It supports z-based intervals for large samples, t-based intervals for small samples, proportion intervals using the normal approximation, and required sample size calculations.

Enter your sample statistics and desired confidence level to get the interval bounds, margin of error, and step-by-step formula breakdown.

Your calculations will appear here

How to Use the Confidence Interval Calculator

  1. Choose the interval type: CI for Mean (Z) when you know the population standard deviation, CI for Mean (T) when you only have the sample standard deviation, CI for Proportion for survey percentages, or Required Sample Size to plan how many responses you need.
  2. For the mean modes, enter the sample mean, the standard deviation and the sample size n. For a proportion, enter the number of successes and the sample size.
  3. Enter the confidence level as a decimal, for example 0.95 for 95% confidence. 0.90 and 0.99 are also common.
  4. The result shows the lower bound, the upper bound, the margin of error and the critical value used. The working shows the standard error and each step.

Formula and Theory

A confidence interval gives a range of plausible values for an unknown population quantity. A 95% interval is built by a procedure that captures the true value in 95% of repeated samples. It does not mean there is a 95% probability that the true value lies in this particular interval.

Every interval has the form estimate plus or minus margin of error, where the margin equals a critical value times the standard error. For a mean with known sigma the standard error is sigma / sqrt(n) and the critical value is a z-score (1.96 for 95%). With an unknown sigma, use the sample standard deviation s and a t critical value with n - 1 degrees of freedom, which is wider for small samples.

For a proportion the standard error is sqrt(p-hat x (1 - p-hat) / n), where p-hat is the sample proportion. This simple Wald interval works well for large samples where p-hat is not close to 0 or 1.

Three things shrink an interval: a larger sample, less variable data, or a lower confidence level. Raising the confidence level always widens the interval.

Worked Examples

Example 1: Mean with known standard deviation (z interval)

Problem: A sample of 100 has mean 50. The population standard deviation is 10. Find the 95% confidence interval.

Solution: Standard error = 10 / sqrt(100) = 1. Margin of error = 1.96 x 1 = 1.96. Interval = 50 plus or minus 1.96.

Answer: 48.04 to 51.96

Example 2: Mean with unknown standard deviation (t interval)

Problem: A sample of 25 has mean 50 and sample standard deviation 12. Find the 95% confidence interval.

Solution: Standard error = 12 / sqrt(25) = 2.4. Degrees of freedom = 24, so t = 2.0639. Margin of error = 2.0639 x 2.4 = 4.9534. Interval = 50 plus or minus 4.9534.

Answer: 45.05 to 54.95

Example 3: Proportion

Problem: In a poll of 100 people, 60 say yes. Find the 95% confidence interval for the proportion.

Solution: p-hat = 60 / 100 = 0.6. Standard error = sqrt(0.6 x 0.4 / 100) = sqrt(0.0024) = 0.04899. Margin of error = 1.96 x 0.04899 = 0.0960. Interval = 0.6 plus or minus 0.0960.

Answer: 50.4% to 69.6%

Example 4: Required sample size for a target margin

Problem: How many people are needed for a margin of error of 3 percentage points at 95% confidence, with p = 0.5?

Solution: n = z^2 x p(1 - p) / E^2 = 1.96^2 x 0.25 / 0.03^2 = 0.9604 / 0.0009 = 1067.1, rounded up.

Answer: n = 1,068

Frequently Asked Questions

What does a 95% confidence interval mean?
If you repeated the study 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% probability for one interval.
Should I use the z interval or the t interval?
Use the t interval unless the population standard deviation is genuinely known, which is rare. The t interval is slightly wider for small samples and converges to the z interval as n grows.
Why is a 99% interval wider than a 95% interval?
To be more confident of capturing the true value, you must cast a wider net. The critical value rises from 1.96 to 2.576 for a z interval, so the margin of error is about 31% larger.
How do I make a confidence interval narrower?
Collect more data. Because the margin shrinks with the square root of n, you need four times the sample to halve it. Reducing variability in your measurements or accepting lower confidence also narrows it.
Can I use this for a small sample proportion?
Be careful. The simple formula behaves poorly when the sample is small or the proportion is near 0 or 1, for example 2 successes out of 20. In those cases a Wilson or exact interval is more reliable.
Do overlapping intervals mean no significant difference?
Not necessarily. Two 95% intervals can overlap slightly and the difference can still be significant. To compare groups, test the difference directly, for example with a two-sample t-test.

Related Statistics Calculators

Related Articles