Confidence Interval Calculator

Calculate exact t- and Z-confidence intervals, margin of error, and standard error from summary stats, proportions, or raw data.

Select Distribution & Enter Summary Statistics Choose whether Population Standard Deviation (σ) is unknown (t) or known (Z)
Confidence Level:
%
ADVERTISEMENT
Responsive In-Content Banner (728 × 90 or 336 × 280)

How to Calculate a Confidence Interval

A confidence interval (CI) provides a range of plausible values for an unknown population parameter—such as a true population mean (μ) or population proportion (p)—constructed around your observed sample estimate plus and minus a Margin of Error (E).

Mean Confidence Interval Formula

Using Student's t-distribution (or Z when σ is known)

CI = x̄ ± t* · s √n

Where x̄ is the sample mean, s is sample standard deviation, n is sample size, and t* is the critical value for df = n − 1 degrees of freedom (replace t* and s with z* and σ when population σ is known).

Proportion Confidence Interval Formula

Normal approximation (Wald Z-interval)

CI = p̂ ± z* · √ p̂(1 − p̂) n

Where p̂ = x / n is the sample proportion of successes, n is total sample size, and z* is the standard normal critical value (e.g., 1.9600 for 95% confidence).

Concrete Worked Example (95% t-Confidence Interval)

Suppose an engineer tests n = 25 EV battery packs and measures a sample mean lifespan of x̄ = 48.0 months with a sample standard deviation of s = 5.0 months. Find the 95% confidence interval:

Step 1

Find Critical Value (t*): Since population σ is unknown, use the t-distribution with df = 25 − 1 = 24. At 95% confidence (two-tailed α = 0.05), t* = 2.0639.

Step 2

Compute Standard Error (SE): Divide standard deviation by √n → SE = 5.0 ÷ √25 = 5.0 ÷ 5 = 1.0000.

Step 3

Calculate Margin of Error (E): Multiply critical value by SE → E = 2.0639 × 1.0000 = 2.0639.

Step 4

Construct Interval [x̄ − E, x̄ + E]: Lower = 48.0 − 2.0639 = 45.9361; Upper = 48.0 + 2.0639 = 50.0639 → [45.9361, 50.0639].

Z-Distribution vs. t-Distribution: When to Use Which?

Choosing between a Z-interval and a t-interval depends primarily on whether you know the true population standard deviation (σ) or estimate dispersion from your sample (s):

Criterion Z-Distribution (Standard Normal) t-Distribution (Student's t)
Population Std Dev (σ) Known (from historical census, calibration spec, or theoretical variance) Unknown — estimated using sample standard deviation (s)
Degrees of Freedom (df) Not required (fixed standard normal curve) Required: df = n − 1 (curve shape adapts to sample size)
Tail Behavior Thinner tails; narrower interval for small samples Heavier tails to account for extra uncertainty in estimating s; converges to Z as n grows large
95% Critical Value Always z* = 1.9600 t* = 2.2622 (at n=10), 2.0452 (at n=30), 1.9842 (at n=100)
Best Practical Use Cases Population proportions / percentages, quality control with known σ, very large samples Almost all real-world sample means, raw experimental datasets, clinical & academic studies

Frequently Asked Questions

Because it is rarely possible to measure every single person or item in an entire population, we take a smaller sample and compute an estimate (like an average or a poll percentage). A confidence interval wraps a "safety margin" around that sample estimate—giving you a realistic [Lower, Upper] range where the true population value is likely to live, rather than relying on a single guess.
A 95% confidence level refers to the long-run reliability of the estimation method. If you drew 100 independent random samples of the same size from the population and computed a 95% confidence interval for each sample, roughly 95 out of 100 intervals would contain the true population parameter (and about 5 would miss due to random sampling variation).
Use the t-distribution whenever you are calculating a confidence interval for a mean and only have the sample standard deviation (s)—which is true in nearly all real-world datasets and raw measurements, especially when n < 30. Use the Z-distribution only when the true population standard deviation (σ) is known beforehand, or when calculating standard confidence intervals for proportions/percentages.
Increasing the sample size (n) decreases the margin of error, making your confidence interval narrower and more precise. Because standard error divides by the square root of sample size (SE = s / √n), there are diminishing returns: to cut your margin of error in half, you need to multiply your sample size by four (since √4 = 2).
No—never. All statistical calculations run purely inside your web browser using client-side JavaScript. None of your summary statistics, proportions, or pasted spreadsheet numbers are ever collected, sent over the network, or saved on any server.

Explore Our Free Calculator Series

Fast, privacy-first math & statistical utilities running 100% in your browser.

ADVERTISEMENT
Responsive Bottom Banner (728 × 90 or Auto)