Skip to content
Experiments

A/B test sample size calculator

3 min read · Updated · By the Reveata team

Short answerEnter your current conversion rate, the smallest relative change you want to detect, and the confidence and power you want; the calculator gives the visitors needed per version and in total for a two-version test.

Visitors per version10,317
Visitors in total (two versions)20,634
Detects a change from4% to 4.8%

The most common A/B testing mistake is stopping too early. Deciding the sample size before the test starts, and sticking to it, is the simplest protection. The calculator runs in your browser and sends nothing anywhere.

The inputs

  • Current conversion rate: the rate of the page or step you are testing today, from your own data.
  • Smallest relative change to detect: the minimum detectable effect, as a share of the current rate. 20% on a 5% rate means detecting a move to 6%. Smaller changes need far more visitors.
  • Confidence: how sure you want to be that a "significant" result is not a false alarm. 95% is the usual choice.
  • Power: the chance of detecting the change if it really exists. 80% is a common choice.

The formula

The calculator uses the standard sample size formula for comparing two proportions with a two-sided test:

text
p1 = current rate
p2 = p1 × (1 + relative change)
p̄  = (p1 + p2) ÷ 2
zα = Φ⁻¹(1 − (1 − confidence) ÷ 2)
zβ = Φ⁻¹(power)

n per version = ( zα × √(2 × p̄ × (1 − p̄)) + zβ × √(p1 × (1 − p1) + p2 × (1 − p2)) )² ÷ (p2 − p1)²

Φ⁻¹ is the inverse of the standard normal distribution; the result is rounded up to a whole visitor. The total is twice the per-version figure, since there are two versions with equal traffic.

Worked example

Hypothetical inputs: a 5% conversion rate, a 20% relative change to detect, 95% confidence and 80% power.

  • p1 = 0.05, p2 = 0.06, p̄ = 0.055
  • zα ≈ 1.960, zβ ≈ 0.842
  • n = (1.960 × √(2 × 0.055 × 0.945) + 0.842 × √(0.05 × 0.95 + 0.06 × 0.94))² ÷ 0.01² ≈ 8,157.7, rounded up to 8,158 visitors per version
  • Total: 16,316 visitors, to detect a change from 5% to 6%

Halving the change you want to detect roughly quadruples the sample. With the same inputs and a 10% relative change (5% to 5.5%), you need 31,234 visitors per version.

How to use the result

  • Turn it into a duration. Divide the total by the visitors who reach the tested page in a typical week, and round up to whole weeks so every weekday is covered.
  • If the number is out of reach, change the test, not the maths. Test a bigger change, test on a page with more traffic, or measure a step earlier in the funnel where conversion rates are higher.
  • Pick the change you would act on. The minimum detectable effect should be the smallest improvement worth shipping, not the one that makes the sample convenient.
  • Stop at the planned size, then check significance once with the A/B test significance calculator, which uses the matching two-sided test.

The formula assumes visitors are split evenly, that each visitor counts once and that conversion rates stay steady while the test runs. Launches, sales and seasonal swings break the last assumption.

Getting the inputs from Reveata

Your current conversion rate is the starting point, and it should be the rate of the exact step you are testing:

  • Goal conversion rate (visitors who completed a goal out of all visitors) on the dashboard, filtered to the page under test. See custom goals.
  • Funnels show conversion from one step to the next, which is the right baseline when you test a single step such as the checkout page.
  • Visitors per week on that page, for turning the sample size into a duration.

Frequently asked questions

Why does a low conversion rate need so many visitors?

The difference you are trying to see is small in absolute terms. Detecting 1.0% against 1.2% means telling apart 10 and 12 conversions per thousand visitors, which random variation easily hides.

Should I use 90% or 99% confidence instead?

Lower confidence needs fewer visitors but accepts more false winners; higher confidence needs more. Choose before the test, and use the same level when you check significance.

Does this work for tests with more than two versions?

The formula is for two versions. With more, each version needs at least this many visitors, and comparing several against the control raises the risk of a false positive.

See it with your own numbersReveata ties every visit and sale to the source that brought it. Add your website in a minute.
Get started
Was this page useful?