A/B Test Sample Size Calculator

Find out how many visitors or respondents you need per variation before launching a test, so your result is statistically significant rather than random noise.

required sample size per variation
total across all variations
estimated test duration
target rate to detect

How the sample size is calculated

This tool uses the standard two-proportion power formula for a two-sided test comparing a control rate p1 against a variant rate p2. The minimum detectable effect (MDE) is applied as a relative change, so p2 = p1 × (1 + MDE). For a baseline of 5% and a 20% MDE, the test is powered to detect a move to 6%.

n = (Z1−α/2·√(2·p̄·(1−p̄)) + Z1−β·√(p1·(1−p1)+p2·(1−p2)))² / (p2 − p1)²

Here is the pooled rate (p1 + p2) / 2, Z1−α/2 is the critical value for your confidence level (1.96 at 95%), and Z1−β is the critical value for your chosen power (0.84 at 80%). The Z-scores are obtained from the inverse normal distribution using a rational approximation, so any confidence or power setting is supported, not just preset values. The result n is rounded up — you can never run a partial visitor.

Smaller effects and higher confidence both inflate the required sample dramatically, because n grows with the inverse square of the effect size. Halving the MDE roughly quadruples the visitors you need. The duration estimate simply divides the total required sample by your daily traffic, giving a planning figure in days. Treat these numbers as a pre-test floor: stopping a test early the moment it looks significant inflates false positives, so commit to the calculated sample before you peek at results. For surveys, read "conversion rate" as the proportion picking a given answer and "per variation" as a single population sample.

Related Tools