Estimation

Confidence Interval

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

Z-based CI for a mean, difference of means, proportion, or difference of proportions.

Build CI

Sample Size

n = (z* × σ / E)²

Sample size needed to hit a target margin of error E — inverts each CI formula.

Find Sample Size

The estimation calculators handle the two dual problems of statistical inference: given a sample, construct a confidence interval for the population parameter; or given a target margin of error, determine the sample size needed to achieve that precision.

Each calculator covers the four standard scenarios: a single mean, a difference of two means, a single proportion, and a difference of two proportions. Output includes the point estimate, margin of error, lower/upper bounds, and an interpretation note.

When to use these calculators

Use the Confidence Interval calculator when you have collected data and want to report the range of plausible values for the population parameter at a chosen confidence level (typically 95%). The CI's relationship to the matching hypothesis test is direct: a 95% CI for the difference of means that contains 0 corresponds to a two-sample z-test that fails to reject H₀ at α = 0.05.

Use the Sample Size calculator before data collection to plan how large the sample needs to be to achieve a target margin of error. The calculator inverts each CI formula and rounds the result up to the next integer. The achieved (rounded-up) margin of error is reported alongside the recommended n so you can see how much precision the rounding bought.

Frequently Asked Questions

What does a 95% confidence interval mean?
If you repeated the sampling procedure many times and computed a 95% CI from each sample, roughly 95% of those intervals would contain the true population parameter. Crucially, this is a statement about the procedure, NOT about the single interval you observe — it does NOT mean there's a 95% probability that the true parameter is in your specific interval.
How is sample size affected by margin of error?
Sample size scales inversely with the square of the margin of error: to halve your margin of error, you need roughly 4× the sample size. The Sample Size calculator surfaces this trade-off — small precision gains require disproportionately large sample sizes at the precision end of the curve.
Why use z-based CIs instead of t-based?
Z-based CIs assume σ is known (or n is large enough that the sample SD is essentially σ). T-based CIs estimate σ from the sample and are more conservative for small n. For n ≥ 30 the two agree to within ~1%. The CIs on this site are z-based; for small-n research where σ is unknown, use a t-based tool.
What's the relationship between confidence interval and hypothesis test?
They are mathematically equivalent for the same α. A 95% CI for a parameter that does NOT contain the null value corresponds to a two-tailed test that rejects H₀ at α = 0.05; an interval that contains the null value corresponds to a non-rejection. Each test calculator on this site cross-links to the matching CI mode and vice versa.
Why does Sample Size round UP to the next integer?
Sample size is necessarily a whole number — you can't have 47.3 participants. Rounding up (ceiling) guarantees the actual achieved margin of error is at or below the target. Rounding down would produce a sample size that misses the target precision. The achieved margin of error after rounding is reported in the output.