The formula
n = [z(1−α/2) × √(2p̄(1−p̄)) + z(1−β) × √(p1(1−p1) + p2(1−p2))]² / (p2 − p1)²
- p1 is the baseline rate, p2 = p1 × (1 + MDE), and p̄ is their average.
- This is the standard two-sided test for two proportions with equal traffic to each variant. The result is rounded up.
Example
With a 5% baseline conversion rate, a 10% relative minimum detectable effect (5.00% to 5.50%, an absolute difference of 0.50%), 95% significance and 80% power, you need 31,234 visitors per variant, or 62,468 in total.
Why sample size matters
Small tests produce noisy results. If you stop a test early because one version looks ahead, you will often pick a winner that is not really better. Fixing the sample size before you start, then waiting until both variants reach it, keeps the false positive rate at the level you chose.
Choosing the minimum detectable effect
The required sample grows with the square of the effect you want to find: halving the minimum detectable effect roughly quadruples the visitors needed. Pick the smallest lift that would actually change a decision, not the smallest one possible. Low-traffic sites usually have to test bigger changes.
Common mistakes
Confusing relative and absolute effects is the usual one. A 10% relative lift on 5% is half a percentage point, not ten. Also run the test for whole weeks so weekday and weekend visitors are both counted.
Questions
Significance (95% here) controls false positives: how often you call a winner when there is no real difference. Power (80%) is the chance of detecting a real effect of the size you entered.
They are the common conventions in statistics and in most A/B testing tools. Use 99% when a wrong call is costly, and 90% power when missing a real effect is costly.
Divide the total visitors by the daily traffic that enters the test. Round up to whole weeks.
The figure is per variant for a two-way test. With more variants, each needs at least this many visitors, and you should correct for multiple comparisons.