A/B Test Sample Size Calculator

Work out how many visitors you need per variant — and how long to run your test — before you start an A/B test.

Example
Visitors per variant13,914
Total visitors27,828
Estimated test duration28 days
%
%
Smallest lift you want to detect. 20% means 3.0% → 3.6%.
%
%
80% is standard.

Sample size formula

n = ( z₁₋α/₂ × √(2p̄(1−p̄)) + z₁₋β × √(p₁(1−p₁) + p₂(1−p₂)) )² ÷ (p₂ − p₁)²p₂ = p₁ × (1 + MDE), p̄ = (p₁ + p₂) ÷ 2

Example

With a 3% baseline, a 20% relative MDE, 95% confidence and 80% power, you need about 13,900 visitors per variant. At 1,000 visitors a day across both variants, that’s roughly 28 days.

Choosing a minimum detectable effect

The MDE is the smallest improvement worth detecting. Smaller effects need dramatically more traffic — halving the MDE roughly quadruples the sample size. Low-traffic sites should test bold changes with larger expected effects.

Frequently asked questions

What is statistical power?

Power is the probability of detecting a real effect of at least the MDE. At 80% power, there is a 20% chance you miss a real improvement of that size.

Why is the test duration rounded up to whole days?

You should run tests for complete days — ideally complete weeks — so day-of-week effects don’t bias the result.