Sample size calculator
How many observations do you need to detect a difference between two groups? Enter the effect size you care about, your significance level, and the power you want — the calculator does the rest.
—
How to use it
This sizes the classic comparison of two group means (the design behind a two-sample t-test or a simple A/B test).
- Effect size (Cohen's d) — the smallest difference worth detecting, in standard-deviation units. Don't have one? Use the effect-size calculator on pilot data, or start from the 0.2 / 0.5 / 0.8 conventions.
- Significance level α — your false-positive rate. 0.05 is the usual default.
- Power (1 − β) — the chance of detecting a real effect of that size. 0.80 is conventional; 0.90 is stricter and needs more data.
The formula. For two equal-sized groups, the per-group sample size is
n = 2 · ( (z1−α/k + z1−β) / d )², rounded up, where k is 2 for a two-tailed test and 1 for one-tailed, and the z values are standard-normal quantiles. It's the standard normal approximation — exact enough for planning, and slightly conservative for very small samples.
Reading the result
The headline number is observations per group; the detail line shows the total across both. Notice the trade-offs as you change inputs: a smaller effect, a lower α, or higher power all push the sample size up — often steeply. Halving the effect size roughly quadruples the sample you need.
Then collect, then test — in Stratum. Once you've gathered the data, Stratum runs the two-sample comparison, reports the p-value, the mean difference, and its confidence interval, and checks the assumptions for you. Download Stratum →
See also
- Other calculators
- P-value calculator · Effect-size calculator
- Learn the concept
- Effect size · Confidence interval
- Do it on real data
- Run a t-test