InfyCalculator
📊

Sample Size for a t-Test Calculator

Estimate how many subjects per group you need to detect a given effect size in a two-sample comparison at your chosen power and significance.

Effect size (Cohen's d)
Significance level (α)
Power (1 − β)
Loading calculator…

How it works

n per group ≈ 2 · (z_{α/2} + z_β)² ÷ d² · d = effect size (Cohen’s d)

Power analysis balances four quantities — effect size, significance, power, and sample size — so fixing any three pins the fourth. This normal-approximation formula gives the subjects per group needed for a two-sample comparison of means; it is close to exact for medium and large effects but slightly under-counts for very small samples, where a t-based routine adds a subject or two. Smaller effects and higher power both drive the requirement up sharply, since n scales with 1/d².

Worked example

For a medium effect d = 0.5 at α = 0.05 with 80% power: n = 2 × (1.96 + 0.842)² ÷ 0.5² = 2 × 7.85 ÷ 0.25 = 62.8, rounded up to 63 per group — matching the familiar "about 64 per group" rule of thumb.

Sources: Statistical power — Wikipedia

Frequently asked questions

What effect size should I assume?

Base it on prior studies or the smallest difference that would matter in practice. Cohen's benchmarks — 0.2 small, 0.5 medium, 0.8 large — are a fallback when no domain estimate exists, but a plausible real-world value is always better.

Why does this use z instead of t?

The exact calculation depends on t with non-centrality, which needs iteration because the degrees of freedom depend on n itself. The normal approximation shown here is standard for planning and is accurate to within a subject or two for the effect sizes people usually study.

Is this per group or total?

The headline number is per group, assuming two equally sized groups. The total sample is twice that. For a one-sample or paired test the requirement is roughly half, since the factor of 2 drops out.

Related calculators

This calculator is for educational purposes. Double-check important results before acting on them.