What this calculator does and when to use it
This calculator answers a common study-design question: "how many observations per group do I need to reliably detect a difference of a given size?" It computes the minimum sample size required for a two-sided z-test comparing a sample mean against a reference value (or, equivalently, the per-group size for comparing two means with known variance), given your chosen significance level (alpha), desired statistical power, the population standard deviation, and the smallest effect size you want to be able to detect.
Use it before running an experiment or study — not after — since sample size planning is meant to happen in advance. It's common in A/B testing, quality control, clinical and behavioral research, and any setting where you need to justify that your planned sample is large enough to have a reasonable chance of detecting a real effect, rather than risking an underpowered study that misses effects that are actually there.
The formula
n = ((zα/2 + zpower) × σ ÷ δ)²
- Alpha (α) — your significance level (false-positive rate), commonly 0.05. zα/2 is the critical value of the standard normal distribution for a two-sided test at that alpha.
- Power — the probability of correctly detecting a real effect if one exists, commonly 0.80 or 0.90. zpower is the corresponding standard normal quantile.
- Sigma (σ) — the standard deviation of the outcome measure in the population, usually estimated from prior data or a pilot study.
- Delta (δ) — the minimum detectable effect: the smallest true difference from the reference value you want the test to be able to catch.
This calculator finds zα/2 and zpower using the inverse of the standard normal cumulative distribution function (a full numerical approximation), so it works correctly for any alpha and power you enter — not just a few common textbook values.
Worked example
With the default inputs — alpha = 0.05, power = 0.8, sigma = 10, delta = 4 — zα/2 = z0.975 ≈ 1.960 and zpower = z0.8 ≈ 0.842. n = ((1.960 + 0.842) × 10 ÷ 4)² = (2.802 × 2.5)² = 7.005² ≈ 49.07, which rounds up to n = 50 — matching exactly what the calculator returns for these inputs. The standardized effect size d = δ ÷ σ = 4 ÷ 10 = 0.4, shown as the fourth result.
Common mistakes and how to interpret the result
- Using an unreliable estimate of sigma. The required sample size is very sensitive to sigma — if your estimate of the population standard deviation is too low, your study will be underpowered in practice even though the calculator's math is correct for the number you entered.
- Confusing a two-sided and one-sided test. This calculator assumes a two-sided (two-tailed) test, which is more conservative (requires a larger sample) than a one-sided test at the same alpha — use it only when you genuinely care about detecting a difference in either direction.
- Treating power below 0.8 as acceptable by default. 80% power is a common convention, not a rule — studies where missing a real effect is costly often use 90% power, which increases the required sample size.
- Rounding down instead of up. The required sample size should always be rounded up to the next whole number (this calculator does so automatically) — rounding down would leave the study slightly underpowered relative to your target.