Free tool

A/B Test Sample Size Calculator

Before you launch an experiment, find out how many visitors each variant needs so the result is actually trustworthy. Enter your numbers and the calculator updates instantly, all in your browser.

31,232
visitors needed per variant
62,464 visitors total across two variants

What drives the number

Why the sample size moves as much as it does

A low baseline costs traffic

The rarer the conversion, the more visitors it takes to separate a real change from noise. Roughly speaking, halving your baseline conversion rate doubles the traffic each variant needs.

The detectable effect is the big lever

Minimum detectable effect enters the formula squared, so it dominates everything else. Asking to detect a 5% lift instead of a 10% one costs about four times the traffic — decide what size of win would actually change your decision, and test for that.

Set the duration before you start

Convert the number above into whole weeks of traffic, then run for that long. Stopping the moment a result turns significant is the most common way teams ship changes that do not hold up.

The formula

How A/B test sample size is calculated, step by step

The calculator uses the standard sample size formula for comparing two conversion rates. For each variant:

n = (zα/2 + zβ)² × [p₁(1 − p₁) + p₂(1 − p₂)] ÷ (p₂ − p₁)²

  • p₁ is your baseline conversion rate, as a fraction.
  • p₂ is the rate you want to be able to detect: the baseline raised by the minimum detectable effect, so p₂ = p₁ × (1 + MDE).
  • zα/2 comes from the confidence level, two-sided: 1.645 at 90%, 1.96 at 95%, 2.576 at 99%.
  • zβ comes from the power: 0.842 at 80%, 1.282 at 90%, 1.645 at 95%.

Worked example: the default inputs

A 5% baseline, a 10% relative lift, 95% confidence and 80% power:

  • p₁ = 0.05 and p₂ = 0.05 × 1.10 = 0.055, so the difference to detect is 0.005.
  • (1.96 + 0.8416)² = 2.8016² ≈ 7.849.
  • p₁(1 − p₁) + p₂(1 − p₂) = 0.0475 + 0.051975 = 0.099475.
  • n = 7.849 × 0.099475 ÷ 0.005² ≈ 31,231.0, rounded up to 31,232 visitors per variant.

Two variants need 62,464 visitors in total. That is the figure the calculator shows before you change anything.

At a glance

Sample size per variant for common baselines

Visitors needed per variant at 95% confidence and 80% power. Read across for the relative lift you want to detect.

Baseline rate5% lift10% lift20% lift30% lift
1%637,014163,09442,69119,824
2%315,20780,68021,1069,795
5%122,12331,2328,1563,778
10%57,76114,7493,8391,772
20%25,5806,5071,680769

Two patterns stand out. Halving the lift you want to detect roughly quadruples the sample. And a low-converting step, such as a 1% purchase rate, needs several times the traffic of a 10% step, such as a click through to pricing.

Test duration

How long should an A/B test run?

Turn the sample size into a duration before you launch:

days = visitors per variant × number of variants ÷ daily visitors who enter the test

Then round up to whole weeks. Weekday and weekend visitors behave differently, so a test that ends mid-week over-weights some days.

  • With the defaults (62,464 visitors in total) and 2,000 eligible visitors a day: 31.2 days, so run for 5 weeks.
  • With 5,000 eligible visitors a day: 12.5 days, so run for 2 weeks.
  • With 800 eligible visitors a day: 78 days. That is a sign to test a bigger change or a busier page (see below).

Count only visitors who actually reach the page or step being tested, not total site traffic. A checkout test only enrolls people who reach checkout.

Even with a lot of traffic, run for at least one full week. Decide the end date up front and do not stop early because the result looks significant on day three. Checking repeatedly and stopping at the first significant reading inflates the false-positive rate well above the confidence level you chose.

Confidence and power

What confidence level and statistical power do to the number

Confidence protects against false positives: calling a winner when there is no real difference. At 95%, a test of two identical variants shows a “significant” result about 5% of the time.

Power protects against false negatives: missing a real effect. At 80% power, if the true lift is exactly your minimum detectable effect, the test detects it 8 times out of 10.

Raising either one costs traffic. With a 5% baseline and a 10% lift:

ConfidencePowerPer variantvs. default
90%80%24,601−21%
95%80%31,232default
95%90%41,812+34%
99%80%46,470+49%

One-sided vs two-sided tests

The confidence level here is two-sided: the test can find the variant better or worse than control. A one-sided test at 95% uses z = 1.645, the same value as two-sided 90%, so it needs the same 24,601 visitors per variant. That saving is only honest if you would treat “worse” and “no different” the same way. If a losing variant would change what you do, keep the test two-sided.

Common mistakes

Mistakes that make the sample size wrong

  • Relative vs absolute effect. The minimum detectable effect here is relative. Moving a 5% rate to 6% is a 20% relative lift (8,156 per variant). Entering 1 would mean 5% to 5.05%, which needs about 3 million per variant.
  • Counting the wrong unit. The sample size counts the unit you randomize and convert. If you assign variants per visitor, count visitors, not sessions or pageviews. Repeat sessions from one person are not independent samples.
  • More than two variants. The figure is per variant, so an A/B/C test needs three times it. Each extra comparison against control also raises the chance of a false winner; a common fix is to split the error rate across comparisons, for example testing each of two comparisons at 97.5% instead of 95%.
  • Diluted traffic. If only some of the enrolled visitors ever see the change, the real effect is watered down and the test is underpowered. Enroll people at the point where the variants actually differ.
  • Changing the test mid-run. Editing a variant, changing the traffic split or adding a variant halfway through restarts the clock.

Low traffic

What to do when the sample size is more traffic than you have

  • Test a bigger change. A redesigned pricing page can plausibly move conversion by 20–30%; a button color cannot. Larger effects need far smaller samples.
  • Measure a higher-converting step. Test on the click through to signup rather than on paid conversion, then confirm the downstream effect over a longer period.
  • Accept 90% confidence knowingly. It saves about a fifth of the traffic in exchange for more false positives. Write the trade-off down before the test starts.
  • Do not A/B test at all. For small sites, watching session replays of people who drop off, and checking where the funnel leaks, usually finds the problem faster than a test that cannot reach significance.

When the test has run its full length, check the result with the A/B test significance calculator.

FAQ

About sample size

How is A/B test sample size calculated?

This tool uses the standard two-proportion formula based on your baseline conversion rate, the minimum detectable effect, your chosen confidence level, and statistical power to estimate the visitors needed per variant.

What is a minimum detectable effect?

The minimum detectable effect is the smallest relative change in conversion rate you want the test to be able to detect reliably. Smaller effects require larger samples.

Why does my test need so many visitors?

Lower baseline rates, smaller effects, higher confidence, and higher power all increase the sample size required to avoid false positives and false negatives.

What is the formula for A/B test sample size?

Per variant, n = (z for confidence + z for power)² × [p₁(1 − p₁) + p₂(1 − p₂)] ÷ (p₂ − p₁)², where p₁ is the baseline rate and p₂ is the baseline raised by the minimum detectable effect. At 95% confidence and 80% power the z values are 1.96 and 0.842; a 5% baseline and a 10% lift give 31,232 visitors per variant.

What is statistical power in an A/B test?

Power is the probability that the test detects an effect when one really exists at the size you specified. 80% power is the usual default: if the true lift equals your minimum detectable effect, the test finds it 8 times out of 10 and misses it 2 times. Raising power to 90% reduces misses but needs about 34% more visitors.

How long should an A/B test run?

Divide the total sample (visitors per variant times the number of variants) by the daily visitors who enter the test, then round up to whole weeks. Run at least one full week so every weekday is represented, and fix the end date before you start instead of stopping when the result first looks significant.

Is the minimum detectable effect relative or absolute?

Relative. A 10% effect on a 5% baseline means detecting a move from 5% to 5.5%. To detect 5% to 6%, enter 20.

Can I use this calculator for more than two variants?

Yes. The result is per variant, so multiply it by the number of variants including control. Comparing several variants against control raises the chance of a false winner, so consider a stricter confidence level for each comparison.

Related

More from PulsePanda

Run the test, then watch the sessions

PulsePanda pairs your experiments with session replay, heatmaps, funnels, and feedback so you understand the why behind the win.

Start for free