Confidence Interval Calculator

Calculate confidence intervals for a mean (z or t) or a population proportion. Get the margin of error, critical value, and bounds with clear step-by-step work.

Mean (z) Mean (t) Proportion Interval Bar · Steps · Wilson Score
Share this tool

Interval Type

Confidence Level

Sample Size

Formula Preview

x̄ ± z* × (σ / √n)

Sample Mean

Standard Deviation

Number of Successes

Quick Load:

Calculating interval...

Choose an interval type, fill in the values, and calculate the confidence interval instantly.

What Is a Confidence Interval?

A confidence interval is a range of values used to estimate an unknown population parameter. Instead of reporting a single point estimate, such as a sample mean of 50, you report an interval such as 46.4 to 53.6. That interval communicates how much uncertainty is attached to the estimate because it came from a sample rather than the whole population.

The confidence level tells you how often the method would produce an interval that contains the true parameter if you repeated the sampling process many times. A 95% confidence interval means that about 95% of those intervals would capture the true value. It does not mean there is a 95% probability that any one computed interval contains the true value; once the interval is calculated, the true value is either inside or outside.

How a Confidence Interval Is Built

Mean, known σ
x̄ ± z* × (σ / √n)
Mean, unknown σ
x̄ ± t* × (s / √n)
Proportion
Wilson score interval around p̂ = x / n

Confidence Interval for a Mean (z)

Use the z interval when the population standard deviation σ is known and the sample is large enough for the Central Limit Theorem to apply. The formula is x̄ ± z* × (σ / √n). The standard error σ / √n measures how far the sample mean is expected to drift from the population mean due to random sampling alone.

The critical value z* comes from the standard normal distribution. For 95% confidence, z* is about 1.96. For 99% confidence, it is about 2.576. A higher confidence level makes the interval wider because you need more room to be more confident. Increasing the sample size narrows the interval because the standard error shrinks.

Confidence Interval for a Mean (t)

In practice the population standard deviation is rarely known. When you must estimate it from the same sample, use the sample standard deviation s and replace z* with t*. The t distribution has heavier tails than the normal distribution, so t* is larger than z* for the same confidence level, especially when the sample size is small.

The degrees of freedom are n - 1. With only a few observations, the t distribution is much wider than the normal curve. As the sample size grows, the t distribution approaches the normal distribution and the t interval becomes nearly identical to the z interval. This is why many textbooks say you can use z for large samples even when σ is unknown.

Confidence Interval for a Proportion

When estimating a population proportion from a count of successes out of n trials, the sample proportion is p̂ = x / n. The simplest Wald interval is p̂ ± z* × √(p̂(1-p̂)/n), but that interval performs poorly when the proportion is near 0 or 1 or when the sample size is small.

This calculator uses the Wilson score interval, which gives more reliable bounds near the extremes. It adjusts the centre and margin so that the interval never extends below 0 or above 1 and has better coverage probability. The result is reported as a percentage for easy reading.

How to Choose a Confidence Level

Most research uses 95% confidence because it strikes a balance between precision and certainty. A 90% interval is narrower but fails to capture the true value more often. A 99% interval is wider and captures the true value more often, but the extra width can make the estimate less useful for decision making.

The right confidence level depends on the consequences of being wrong. In medical trials or safety engineering, 99% or even higher may be justified. In exploratory analysis, 90% may be enough. The confidence level should be chosen before looking at the data, not adjusted until the interval looks appealing.

Common Confidence Levels and z* Values

Confidence levelTail area (α)Critical z*
90%0.101.645
95%0.051.960
99%0.012.576
99.9%0.0013.291

These z* values are exact for the standard normal distribution. For a t interval, the critical value also depends on the degrees of freedom and is slightly larger than the corresponding z* value.

Confidence Interval FAQ

What does a 95% confidence interval mean? +

It means that the method used to build the interval would capture the true population parameter in about 95% of repeated samples. It does not mean that any single interval has a 95% chance of containing the parameter.

When should I use a z interval instead of a t interval? +

Use a z interval when the population standard deviation is known. Use a t interval when you only have the sample standard deviation, which is the typical situation in real data analysis.

What is the standard error? +

The standard error is the standard deviation of a sampling distribution. For a mean it is σ / √n when σ is known, or s / √n when σ is estimated. It measures how far sample estimates typically vary from the true value due to sampling alone.

How do I calculate a confidence interval for a proportion? +

Compute the sample proportion p̂ = x / n, find the critical z-value for your confidence level, and add and subtract the margin of error. This calculator uses the Wilson score interval, which is more accurate than the simple Wald interval near 0% or 100%.

Why must the sample size be at least 2 for a t interval? +

A t interval needs at least one degree of freedom, which is n - 1. With n = 1 the sample standard deviation is undefined and the t distribution has no meaningful spread.

What happens to the margin of error when I increase the sample size? +

The margin of error decreases because the standard error shrinks as n grows. To cut the margin of error in half, you generally need to quadruple the sample size, assuming everything else stays the same.

External Resources

Related Calculators