When to use it
Use this when you plan to compare the average of a continuous outcome between two independent groups — treatment vs. control, A vs. B, drug vs. placebo — and the analysis will be a two-sample t-test. If your outcome is a yes/no rate instead of a mean, use the A/B test sample size calculator; for before/after measurements on the same people, use the paired sample size calculator.
The inputs explained
- Difference in means (Δ) — the smallest clinically or practically meaningful difference you want to detect.
- Standard deviation (σ) — the within-group spread of the outcome, from a pilot or the literature. The formula assumes the two groups share it.
- Significance (α) and power — 0.05 and 80% are standard defaults.
- Direction — two-sided unless you committed to a single direction in advance.
Together Δ and σ give the effect size (Cohen's d = Δ / σ), which is what the sample size really depends on.
Worked example
A trial expects a 5-point difference on a scale whose SD is 10, so d = 0.5. At α = 0.05 (two-sided) and 80% power, you need about 64 per group (128 total). If the true difference were only 2 points (d = 0.2), you would need about 393 per group — six times as many.
The formula
For equal-sized groups, the sample size per group is
n = 2 (z1−α/2 + z1−β)² / d², with d = Δ / σ
This normal approximation is standard for planning; for very small samples the exact t-based value is slightly larger, so rounding up is the safe habit. See the methodology page.
Common mistakes
- Optimistic effect size — overstating Δ or understating σ gives a sample that is too small to find the real effect.
- Ignoring dropout — inflate the number to cover attrition and unusable data.
- Using it for paired data — pre/post on the same subjects needs the paired calculator and far fewer subjects.
- Post-hoc power — compute power before the study, not after a null result.