Skip to main content

Calcu.fit

Confidence Interval Calculator: For a Mean or a Proportion

Use this free confidence interval calculator to estimate a range that is likely to contain the true value for a whole group, based on a sample. Enter your sample mean, the standard deviation, and the sample size to get a confidence interval and the margin of error. Or enter the number of successes and the sample size to get an interval for a proportion, as used in polls and surveys. You can also find the sample size you need for a target margin of error. No signup needed.

Confidence Interval Calculator

Calculate confidence intervals for a population mean or proportion, or find the sample size needed for your desired margin of error.

Example: 120 successes out of 400 responses.

Use 0.5 if the proportion is unknown.

Calculation Results

Result—

Formula & Calculation Steps

Common Z Critical Values

80%1.282
90%1.645
95%1.960
98%2.326
99%2.576
99.9%3.291

How to Use This Confidence Interval Calculator

For a mean:

  1. Choose “Mean.”
  2. Enter the sample mean (x̄), the standard deviation, and the sample size (n).
  3. Choose whether the standard deviation is for the population (known) or the sample (estimated from your data).
  4. Choose the confidence level, such as 90%, 95%, or 99%.
  5. Click Calculate.

For a proportion:

  1. Choose “Proportion.”
  2. Enter the number of successes and the sample size, or the sample proportion and the sample size.
  3. Choose the confidence level, and click Calculate.

For sample size:

  1. Choose “Sample size.”
  2. Enter the margin of error you want and the confidence level, plus the standard deviation (for a mean) or an estimated proportion (use 50% if unsure).
  3. Click Calculate.

What You’ll See in Your Results

  • The confidence interval (lower and upper limits)
  • The margin of error
  • The standard error
  • The critical value (z or t)
  • The sample size needed, if you ask for it
  • The steps and the formula used

What Is a Confidence Interval?

A confidence interval is a range of values, built from sample data, that is likely to contain the true value for the whole population. For example, a poll finds that 52% of voters support a plan, with a margin of error of 3 points. The 95% confidence interval is 49% to 55%.

 

A 95% confidence level means that if you repeated the sampling process many times, about 95% of the intervals you build would contain the true value. It does not mean there is a 95% chance that this one interval contains the true value, once it has been calculated. The true value is a fixed number, and the interval either contains it or does not.

The Confidence Interval Formulas

Confidence interval = Estimate ± Margin of error

Margin of error = Critical value × Standard error

For a mean, when the population standard deviation (σ) is known:

  • Standard error = σ ÷ √n
  • Interval: x̄ ± z × σ ÷ √n

For a mean, when only the sample standard deviation (s) is known:

  • Standard error = s ÷ √n
  • Interval: x̄ ± t × s ÷ √n, using the t value with n − 1 degrees of freedom

For a proportion:

  • Sample proportion: p̂ = successes ÷ n
  • Standard error = √(p̂ × (1 − p̂) ÷ n)
  • Interval: p̂ ± z × √(p̂ × (1 − p̂) ÷ n)

Sample size for a mean: n = (z × σ ÷ E)²
Sample size for a proportion: n = z² × p × (1 − p) ÷ E², where p = 0.5 if unknown

E is the margin of error you want. Round the sample size up to the next whole number.

Common Critical Values (z)

Confidence levelz critical value
80%1.282
90%1.645
95%1.960
98%2.326
99%2.576
99.9%3.291

When to Use z or t

  • Use z when you know the population standard deviation, or when the sample is large (often n ≥ 30) and you use the sample standard deviation as an estimate.
  • Use t when you do not know the population standard deviation and the sample is small. The t value is larger than z for small samples, which makes the interval wider to reflect the extra uncertainty. As n gets larger, t gets closer to z.

For 95% confidence, the t value is about 2.365 for n = 8 (7 degrees of freedom), 2.064 for n = 25 (24 degrees of freedom), and 2.045 for n = 30 (29 degrees of freedom).

Confidence Interval Examples

Example 1: Mean with a Known Standard Deviation

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

  • Standard error: 10 ÷ √100 = 1
  • Margin of error: 1.96 × 1 = 1.96
  • Interval: 50 ± 1.96, or 48.04 to 51.96

Example 2: Mean with an Estimated Standard Deviation (t)

A sample of 8 values has a mean of 14.875 and a sample standard deviation of 2.997.

  • Standard error: 2.997 ÷ √8 = 1.060
  • t value for 95% and 7 degrees of freedom: 2.365
  • Margin of error: 2.365 × 1.060 = 2.51
  • Interval: 14.875 ± 2.51, or 12.37 to 17.38

Example 3: A Larger Sample (t)

A sample of 25 has a mean of 72 and a sample standard deviation of 8.

  • Standard error: 8 ÷ √25 = 1.6
  • t value for 95% and 24 degrees of freedom: 2.064
  • Margin of error: 2.064 × 1.6 = 3.30
  • Interval: 72 ± 3.30, or 68.70 to 75.30

Example 4: How the Confidence Level Changes the Interval

Using Example 1 (mean 50, standard error 1):

Confidence levelzMargin of errorInterval
90%1.6451.64548.36 to 51.64
95%1.9601.96048.04 to 51.96
99%2.5762.57647.42 to 52.58

A higher confidence level gives a wider interval. You trade precision for confidence.

Example 5: How Sample Size Changes the Interval

With a standard deviation of 10 and 95% confidence:

Sample sizeMargin of error
25±3.92
100±1.96
400±0.98

A larger sample gives a narrower interval. To cut the margin of error in half, you need about four times as many observations.

Example 6: A Proportion from a Survey

In a survey of 400 people, 120 say they prefer a product.

  • Sample proportion: 120 ÷ 400 = 0.30
  • Standard error: √(0.30 × 0.70 ÷ 400) = 0.0229
  • Margin of error: 1.96 × 0.0229 = 0.0449, or 4.49 points
  • 95% interval: 0.30 ± 0.0449, or 25.5% to 34.5%

(The Wilson method, which works better for small samples or for proportions near 0 or 1, gives 25.7% to 34.7%.)

Example 7: A Poll

A poll of 1,000 people finds that 52% support a proposal.

  • Margin of error: 1.96 × √(0.52 × 0.48 ÷ 1,000) = 3.10 points
  • 95% interval: 48.9% to 55.1%

Since the interval includes 50%, this poll cannot rule out that support is below half.

Example 8: Sample Size for a Proportion

You want a margin of error of ±3% with 95% confidence, and you do not know the proportion, so you use 50%.

  • n = 1.96² × 0.5 × 0.5 ÷ 0.03² = 1,067.1, so you need 1,068 people
  • For ±5%: n = 384.2, so 385 people
  • For ±3% with 99% confidence: n = 1,843.3, so 1,844 people

Example 9: Sample Size for a Mean

You want to estimate a mean within ±2, the standard deviation is about 10, and you want 95% confidence.

  • n = (1.96 × 10 ÷ 2)² = 96.04, so you need 97 observations

How to Read a Confidence Interval

  • The range tells you precision. A narrow interval means a more precise estimate. A wide interval means more uncertainty.
  • Checking a value: if a value (such as 50%, or 0) is outside the interval, the data are not consistent with that value at that confidence level.
  • Comparing two groups: if two 95% intervals do not overlap, the difference is likely real. If they overlap a bit, there may still be a real difference, so use a proper test for the difference.
  • It is about the average, not individuals. A confidence interval for a mean does not tell you the range where most individual values fall.

Common Mistakes

  • Saying “there is a 95% chance the true value is in this interval.” The correct view is that the method captures the true value in 95% of repeated samples.
  • Using z with a small sample and an unknown standard deviation. Use t instead.
  • Ignoring bias. A confidence interval accounts for random sampling variation, not for bad sampling, poor survey questions, or measurement errors.
  • Using the proportion formula for very small counts. For few successes, use the Wilson or an exact method.
  • Confusing the margin of error with the standard deviation. The margin of error shrinks as the sample grows, but the standard deviation of the data does not.
  • Treating the interval as the range of individual data. It is about the mean or proportion.

Tips for Using a Confidence Interval Calculator

  • Check that your sample is random and representative.
  • Decide your confidence level before you collect data. 95% is the most common.
  • Use the sample standard deviation and t for small samples.
  • Report the interval and the confidence level together, for example “52% (95% CI: 48.9% to 55.1%).”
  • Plan your sample size in advance, using the target margin of error.
  • Remember that larger samples give narrower intervals, but the gains slow down.
  • For important research or decisions, check your method with a statistician.

Confidence Interval Calculator vs. Other Tools

  • Statistics Calculator: mean, median, standard deviation, and more.
  • Sample Size Calculator: the sample size needed for a survey or study.
  • Margin of Error Calculator: the margin of error from a sample.
  • Z-Score Calculator: how far a value is from the mean.
  • Probability Calculator: the chance of events.
  • Scientific Calculator: general math and functions.

Frequently Asked Questions (FAQ)

What is a confidence interval?

A range of values, based on a sample, that is likely to contain the true value for the whole population. A 95% confidence interval is built by a method that captures the true value in about 95% of repeated samples.

Calculate the standard error (standard deviation ÷ √n), multiply it by the critical value (z or t), and add and subtract the result from the sample mean. For a mean of 50, a standard deviation of 10, and n = 100, the 95% interval is 48.04 to 51.96.

 Find the sample proportion p̂, calculate √(p̂ × (1 − p̂) ÷ n), multiply by z, and add and subtract from p̂. For 120 of 400, the 95% interval is 25.5% to 34.5%.

 Half the width of the confidence interval. It is the critical value times the standard error.

If you repeated the study many times, about 95% of the intervals would contain the true value. It does not mean there is a 95% probability that one specific interval contains it.

1.96. For 90% it is 1.645, and for 99% it is 2.576.

Use t when you do not know the population standard deviation and your sample is small. For large samples, t and z are almost the same.

A larger sample gives a smaller standard error and a narrower interval. To halve the margin of error, you need about four times the sample size.

A higher confidence level, such as 99% instead of 95%, gives a wider interval.

For a proportion, n = z² × p × (1 − p) ÷ E². For a margin of error of 3% at 95% confidence with p = 0.5, you need 1,068 people.

It can for small samples or extreme proportions, such as going below 0% or above 100%. In that case, use a better method such as the Wilson interval, and limit the range to 0% to 100%.

Yes. It is free, with no registration and no limits.

It uses standard formulas and the numbers you enter. The result assumes a random sample and a reasonably normal distribution (or a large sample), and it does not correct for bias.

Disclaimer

This calculator is for general informational and educational purposes only. Results depend on the numbers you enter and on assumptions such as random sampling. They do not account for bias or errors in data collection. For research, medical, business, or other important decisions, consult a qualified statistician.