Bell Statistics

A/B test sample size calculator

Enter your baseline conversion rate and the smallest lift worth shipping, and get the number of users each arm needs before you launch. When the test finishes, the second tab turns four raw counts into a lift, a p-value and a confidence interval on the difference. A metric that is a measurement rather than a rate wants [the two-sample t-test](/calculators/two-sample-t-test).

Allon Korem

Written by Allon Korem

Chief Executive Officer

Last updated

Calculator

A proportion, so 0.04 is 4%.

On the baseline's scale: 0.005 is half a point.

n₂ ÷ n₁. 1 is an even split.

Pooled matches the test you will run.

On adds a few percent to the sample.

Required sample size per arm
Per variant25,551
Second arm25,551
Total51,102
Achieved powerAt the whole-number sample above.80.0%
Baseline rate4.00%
Rate it can detect4.50%
Relative lift it can detectAs a share of the baseline rate.12.5%

Give each variant 25,551 visitors — 51,102 across the experiment, not 25,551 in total — and the test will detect a move from 4.00% to 4.50% 80.0% of the time, if a lift that large is really there. That is a floor on what the design can see, not a forecast of what you will get: the minimum detectable effect should be the smallest lift that would change what you do, not the lift you are hoping for. Against a true lift half this size the same sample has about 29.5% power, so the likeliest outcome there is a non-significant result that reads as "no impact" when it was really "no ability to tell".

  • Without the continuity correction this is the smaller of the two standard answers. Applying the correction adds a few percent to the sample and matches an analysis that also applies it.
Sample size per variant against statistical powerReaching 2.6% power takes 1 per variant and 97.7% takes 50,695; the 80.0% target is met at 25,551.10,00020,00030,00040,00050,0000%25%50%75%100%PowerSample size — per variant80.0% → 25,551

Drag the dashed line — or focus it and use the arrow keys — to change the target power and resize the study.

Show these numbers as a table
Power at each sample size per variant
PowerSample size
2.6%1
20.7%4,261
36.6%8,521
50.9%12,781
62.9%17,041
72.5%21,301
80.0%25,561
85.7%29,821
89.9%34,081
92.9%38,341
95.1%42,601
96.7%46,861
Required visitors per variant against minimum detectable effectDetecting 0.20% takes 154,304 and 4.00% takes 553. At the 0.50% currently entered it is 25,551 — the requirement falls roughly as the square of the effect.1,00010,000100,0000.50%1.00%1.50%2.00%2.50%3.00%3.50%4.00%Minimum detectable effectRequired visitors per variant (log scale)0.50% → 25,551

Drag the dashed line — or focus it and use the arrow keys — to change minimum detectable effect.

Show these numbers as a table
Required visitors per variant against minimum detectable effect
Minimum detectable effectRequired visitors per variant
0.20%154,304
0.59%18,552
0.98%7,016
1.37%3,738
1.76%2,354
2.15%1,637
2.54%1,215
2.93%945
3.32%761
3.71%629

When to use it

Use this when the outcome is binary — converted or not, signed up or not, still active on day 7 — and two independent groups were formed by random assignment. That is most of what gets called an A/B test. The sample-size tab answers the question worth asking before launch, which is not "how long shall we run it?" but "how small a lift must we be able to see, and what does that cost?"

Neighbouring situations need a different instrument. One group measured against a fixed target — an SLA, a contractual floor — is a one-proportion z-test. Counts small enough that a cell holds single digits belong in Fisher's exact test, where the p-value is computed rather than approximated. Three or more variants is a chi-square test for the overall question, then targeted pairwise comparisons with a correction — running every pair unguarded is how a four-arm test manufactures a winner, as the problem of multiple comparisons sets out. Same people measured twice is paired data, and wants McNemar's test.

The other mismatch is the question itself. This test detects a difference; it cannot demonstrate the absence of one. To show a cheaper vendor or a simplified flow performs no worse, use an equivalence test or, when one direction worries you, a non-inferiority test. And if what matters is how long users take to convert rather than whether they do, the binary summary discards timing that the log-rank test keeps.

Assumptions

Five things have to hold. The first two are load-bearing; the rest are usually satisfied by any competently run experiment.

  • Random assignment, with one observation per randomised unit. If assignment leaked, no amount of statistics repairs it. Check the split against the ratio you intended before you look at the metric: sample ratio mismatch is the cheapest bug detector you have, and the basics of randomisation repay a re-read before launch.
  • The unit of analysis matches the unit of randomisation. Bucket by user but count sessions and the same user contributes several correlated rows, so the standard error is understated and the p-value too small. Aggregate first, or model the clustering.
  • The sample size was fixed in advance. Checking daily and stopping at the first p below 0.05 pushes the real false-positive rate far above 5%. To keep the option of stopping early, adopt a sequential design that budgets for the looks.
  • The normal approximation is adequate — comfortably so once each of the four cells expects ten or more. Below that its p-values are untrustworthy at the third decimal; switch to the exact test. This is the assumption most calculators fail silently on, since they will happily return a p-value for a 3-versus-1 table.
  • One primary metric, nominated in advance. Five metrics at 5% each gives roughly a one-in-four chance of a false positive somewhere — see multiple comparison corrections.

How the calculation works

Sample size uses the normal approximation to the binomial: there is no exact closed form for two proportions, and the approximation is good to within about a percent at the sizes a conversion test needs. You choose whether its variance is pooled under the null — matching the test you will run, and the default here — or computed under the alternative, which is slightly more conservative and is what several textbooks print. You also choose whether to apply a continuity correction, which acknowledges that the binomial is discrete and the normal is not. On the analysis side the p-value is a pooled z-test; the interval is not. If the answer exceeds the traffic you have, [four ways to improve statistical power](/post/four-ways-to-improve-statistical-power-in-a-b-testing-without-increasing-test-duration-duh) beats quietly lowering the target.

Sample size per group, equal allocation
n = [ z₁₋α/₂·√(2p̄(1−p̄)) + z₁₋β·√(p₁(1−p₁) + p₂(1−p₂)) ]² / (p₂ − p₁)², p̄ = (p₁ + p₂)/2

The unpooled option replaces the first square root with √(p₁(1−p₁) + p₂(1−p₂)). The two answers usually differ by well under one percent.

Unequal allocation (n₂ = k·n₁)
n₁ = [ z₁₋α/₂·√(p̄(1−p̄)(1 + 1/k)) + z₁₋β·√(p₁(1−p₁) + p₂(1−p₂)/k) ]² / (p₂ − p₁)²

A 1:1 split minimises the total. Moving to 2:1 costs about an eighth more traffic and 4:1 half as much again — worth paying to limit exposure to a risky change, never worth paying by accident.

Continuity correction
n′ = (n/4)·[ 1 + √(1 + 4/(n·|p₂ − p₁|)) ]²

Inflates n to hold the true type-I error at or below the nominal level. The effect shrinks as n grows: on a test of tens of thousands it adds a percent or two, on one of a few hundred, a fifth.

Test statistic (pooled)
z = (p̂₁ − p̂₂) / √( p̄(1−p̄)(1/n₁ + 1/n₂) ), p̄ = (x₁ + x₂)/(n₁ + n₂)

Pooling is right here: the statistic is evaluated under the null that both arms share one rate. Squaring this z gives exactly the Pearson chi-square statistic for the same 2×2 table, so the two never disagree.

Interval on the difference (Newcombe)
(p̂₁ − p̂₂) − √((p̂₁ − l₁)² + (u₂ − p̂₂)²) to (p̂₁ − p̂₂) + √((u₁ − p̂₁)² + (p̂₂ − l₂)²)

Built from each arm's Wilson limits (lᵢ, uᵢ) rather than one Wald standard error. It stays inside [−1, 1], holds close to nominal coverage at low conversion rates, and does not collapse to zero width when an arm records no events — all three of which Wald gets wrong where conversion tests live.

Relative versus absolute lift
relative lift = (p̂₂ − p̂₁)/p̂₁, absolute lift = p̂₂ − p̂₁

Sizing is driven by the absolute difference. A 10% relative lift on a 40% baseline is four percentage points and cheap to detect; the same relative lift on a 2% baseline is two-tenths of a point and costs roughly thirty times as many users.

Worked example

Your checkout converts at 4.0%. Product will not ship for less than half a percentage point, so 4.5% is the smallest result worth detecting. You want 80% power at the conventional 5% two-sided level, an even split, and roughly 6,000 eligible visitors reach the page each day.

Baseline conversion rate
4.0%
Minimum detectable effect
+0.5 percentage points (4.5%)
Significance level (α)
0.05, two-sided
Power (1 − β)
0.80
Allocation
1:1
Variance
Pooled, no continuity correction

25,551 visitors per arm, 51,102 in total — about nine days at 6,000 visitors a day. Turning on the continuity correction raises it to 25,950 per arm.

Nine days buys a four-in-five chance of detecting a lift of half a point, if that lift is really there. It buys much less against a smaller true effect: at a real lift of a quarter of a point this design has about 30% power, so the likeliest outcome is a non-significant result written up as "no impact" when it was really "no ability to tell". Sizing for that quarter-point needs just under 100,000 per arm — four times the traffic for half the sensitivity, which is the trade every experiment roadmap is really negotiating.

Interpreting the output

Start with the confidence interval on the difference, not the p-value. Both settle the yes/no question — the interval excludes zero exactly when p is below α — but only the interval says which lifts the data is consistent with. An observed +0.6 points with an interval of [+0.05, +1.15] is significant and almost uninformative; +0.1 points with an interval of [−0.15, +0.35] is not significant and genuinely useful, because it rules out anything you would have acted on. That is the core recommendation in reporting A/B test results properly.

The p-value is the probability of a difference at least this large if both variants truly converted at the same rate. It is not the probability that the variant is better, not the probability the result replicates, and 0.049 and 0.051 are the same evidence.

Be careful with relative lift, which is what stakeholders remember. Its interval is asymmetric and wider than the point estimate suggests, and the estimate is biased upward among tests that reached significance — a winner is likelier to have been helped by noise than hurt by it. That is much of why the uplift in an A/B test often differs from what shows up after rollout.

For a bound on one arm's rate rather than the gap between two, the proportion confidence interval calculator does that properly. And if the interval is too wide to support a decision, the honest conclusion is that the test was underpowered, not that the change does nothing — we design experiments where that is settled before launch.

Frequently asked questions

How long should I run an A/B test?
Long enough to reach the sample size you calculated, and never fewer than one full business cycle — usually seven or fourteen days. Traffic composition swings hard by day of week, and a test that starts on a Tuesday and stops on a Friday has measured Tuesday-to-Friday users, not your users. If the required sample arrives in three days, keep running to a whole number of weeks anyway. If it will take four months, the test is not worth running as designed: raise the detectable effect, pick a metric closer to the change, or reduce variance rather than quietly lowering the power target.
What minimum detectable effect should I put in?
The smallest lift that would change what you do, not the lift you are hoping for. If a quarter of a point would not survive the engineering cost of shipping the change, do not pay for the traffic to detect it. Work backwards: estimate what a one-point lift is worth annually, compare that against the cost of the build and the opportunity cost of the traffic, and let the break-even number be your MDE. Choosing it from the answer you want is how tests end up sized for effects nobody would act on.
Can I stop the test early if it is already significant?
Not with a fixed-horizon design. Checking daily and stopping at the first p below 0.05 pushes the real false-positive rate to somewhere between 20% and 40%, depending on how often you look. Early crossings are common and mostly noise: the estimate is at its most volatile when the sample is smallest, and it is precisely the runs that overshoot that cross first. If you need the option to stop early, use a sequential or group-sequential design that spends the error budget across the looks, and fix that before launch rather than after the first promising day.
Should I use a one-sided test to save traffic?
It cuts the required sample by around 20%, but only honestly if you would take exactly the same action for a large negative result as for no result at all. In product work that is rarely true — a variant that hurts conversion by two points is information you very much want. The bigger risk is procedural: switching to one-sided after a two-tailed test lands at p = 0.07 is not a statistical choice, it is a way of getting the answer you wanted. Decide before launch, write it down, and default to two-sided.
Does a 90/10 split cost me anything?
Yes, and much more than the intuition suggests. A 1:1 split extracts the most information per user. A 9:1 split needs close to three times the total traffic for the same power, because the power is governed by the smaller arm. Skewed splits are legitimate when you are limiting blast radius on a risky release or reusing a large existing control, but they should be a deliberate purchase, not a leftover from a cautious ramp that nobody rebalanced.
Pooled or unpooled variance — does the choice matter?
For the sample size, almost never: the two formulas typically differ by well under one percent, and that difference is smaller than the error in your baseline rate estimate. For the test statistic it matters more in principle, and pooled is correct, because the statistic is computed under the null hypothesis that both arms share a single rate. The pooled z is also exactly equivalent to the Pearson chi-square test on the same table, which is why those two never disagree. Use pooled unless you have a specific reason not to.

Related calculators

  • Fisher's exact test

    The right test for a 2×2 table of small counts — exact p-values, no normal approximation.

  • One-proportion z-test

    Test one observed rate against a fixed target — an SLA, a benchmark, a contractual floor.

  • Equivalence: two proportions

    Prove two rates are close enough to swap — margin in percentage points, sample size, then both one-sided tests.

Terms on this page

  • A/B testing

    A randomised experiment on live traffic — and randomisation is the only part that makes it causal.

  • Randomization

    The one mechanism that makes a comparison causal — and the four ways it silently fails.

  • Sample size

    Four inputs, one number, fixed before the test runs — and the square law that makes small effects expensive.

  • Minimum detectable effect

    The smallest lift you designed to catch — a business decision that gets outsourced to statistics.

  • Sequential testing

    How to look at a running test without breaking it — and what peeking costs when you do not.

  • CUPED

    Use pre-period data to strip out noise — the same test, 20-50% less traffic, no change to the estimate.

  • P-value

    How surprising your data would be if there were no effect — and the four things it is constantly mistaken for.

  • Statistical significance

    A verdict about evidence, not about importance — and the difference is where most bad decisions live.

  • Significance level

    The false-positive rate you agree to in advance — a budget, and one most teams overspend.

  • Confidence interval

    The range your data can actually support, and why it answers the business question a p-value cannot.

  • Statistical power

    The probability your test finds a real effect — and why most tests that report nothing were never able to.

  • Type I error

    The false positive — and the one whose cost lands months later, on a roadmap built around noise.

  • Type II error

    The false negative — invisible by nature, which is why nobody counts how many good ideas it kills.

  • Multiple comparisons

    Test enough things and something will look significant — the arithmetic, and the four fixes.

  • Effect size

    How big the difference is — the number a p-value throws away and a business case runs on.

  • Causal inference

    Estimating what an action caused by reconstructing what would have happened without it.

  • Incrementality

    The conversions that would not have happened anyway — and the gap between that and what platforms report.

  • Geo experiment

    Randomise regions instead of users — the way to test marketing that cannot be hidden from a person.

  • Standard deviation

    How spread out the data are, in the data's own units — and the reason some metrics need vastly more sample.

  • Variance

    Spread in squared units — awkward to read, and the quantity every sample-size formula is built on.

  • Standard error

    How much your estimate would move if you ran the study again — precision, not spread.

Talk to the people who build these for a living

We size, run and read experiments where the metric, the sample size and the decision rule are agreed before anyone looks at the data. A/B Testing

References

  • Fleiss, J. L., Levin, B., & Paik, M. C. (2003). Statistical Methods for Rates and Proportions (3rd ed.). Wiley.
  • Newcombe, R. G. (1998). Interval estimation for the difference between independent proportions: comparison of eleven methods. Statistics in Medicine, 17(8), 873-890.
  • Kohavi, R., Tang, D., & Xu, Y. (2020). Trustworthy Online Controlled Experiments: A Practical Guide to A/B Testing. Cambridge University Press.