A/B Test
calculator.
Check whether version B of a page really beats version A, or plan how long a split test needs.
- Chance B beats A
- 99.2%
- 95% interval
- 0.19 pts to 1.81 pts
- z
- 2.412
B converts at 5% against 4%, and a gap this large would turn up by chance less than 5% of the time if they were equal. The interval for the difference stays above zero, from 0.19 pts to 1.81 pts.
Where your z falls
If A and B truly converted alike, z would follow this curve. Your z of 2.412 is past the critical value of ±1.960, and the two shaded tails, 0.0159, are the p-value.
The smallest lift this test could find
- Lift found 80% of the time
- 29.3%
- That is B converting at
- 5.17%
- Visitors per version used
- 5,000
At 4% for A and 95% confidence. A real lift smaller than this would often go unseen.
What each conversion rate could be
With a flat prior, A's true rate is most likely near 4% and B's near 5%. The chance B is really higher is 99.2%, and shipping B gives up 0.0011 pts on average if it is not.
To detect other lifts from A's 4%
| Lift | B would convert at | Per variant |
|---|---|---|
| 5% | 4.2% | 154,302 |
| 10% | 4.4% | 39,473 |
| 15% | 4.6% | 17,940 |
| 20% | 4.8% | 10,314 |
| 30% | 5.2% | 4,780 |
| 50% | 6% | 1,861 |
At 95% confidence and 80% power. Small lifts on low rates need far more visitors.
How this result was worked out
- 1Conversion rate of each versionA: 200 ÷ 5,000 = 4%B: 250 ÷ 5,000 = 5%
- 2Pooled rate: all conversions over all visitors, as if A and B were the same(200 + 250) ÷ (5,000 + 5,000) = 4.5%
- 3Standard error of the gap, from the pooled rateSE = √(0.045 × (1 − 0.045) × (1 ÷ 5,000 + 1 ÷ 5,000)) = 0.004146
- 4z: the gap in rates over its standard errorz =5% − 4%0.004146= 2.412
- 5Two-tailed p-value from the normal curvep = 2 × (1 − Φ(2.412)) = 0.0159, so significant at 95%
- 6The 95% interval: the gap ± critical z × the unpooled SE1 pts ± 1.960 × 0.4145 pts = 0.19 pts to 1.81 pts
- 7Check: z times its standard error gives the gap back, and z² is the chi-square2.412 × 0.004146 = 1 ptsz² = 5.817, the Pearson chi-square for the same table
How it's worked out
In a split test, some visitors see the current version, A, and some see a change, B. You count visitors and conversions for each. Because people convert at random, B can look better by luck, so the question is how surprising the gap would be if the two were really the same.
Here c is conversions, n is visitors and each p with a hat is a conversion rate. The pooled rate, p with a bar, is the rate you would expect from both if they were equal. This is the two-proportion z-test in the NIST handbook. The p-value is the chance of a z at least this far from zero, in either direction, if A and B convert alike. The result is significant when the p-value is below 1 minus your confidence level.
The confidence interval for the gap uses each rate on its own standard error, not the pooled one. For the Bayesian view, each rate starts from a flat prior and becomes a beta distribution after the data. The chance that B beats A comes from the exact sum Evan Miller published, so it needs no simulation. Expected loss, as Chris Stucchio defines it, is how much conversion rate you give up on average by picking a version if it is really the worse one.
To plan a test, you choose the smallest lift worth finding, the confidence and the power. Power is the chance the test finds the lift if it is real. The sample size formula then gives the visitors each version needs, where p1 is your current rate, p2 the rate with the lift, and V the spread of the two.
Worked examples
A new checkout button
A shop shows the old checkout button to 5,000 visitors and gets 175 orders, 3.5%. The new button gets 220 orders from 5,000, 4.4%. The lift is +25.7%, with z = 2.310 and p = 0.0209, so the result is significant at 95%.
The 95% interval for the gap runs from 0.14 points to 1.66 points, so the true lift could be small. The Bayesian view gives B a 99% chance of being better, and shipping it risks an expected loss of only 0.0014 points. At 99% confidence the same data would not pass.
A promising lift that is not proven yet
A landing page test has 96 and 110 sign-ups from 2,400 visitors each. B is ahead by +14.6%, but p = 0.3187 and the interval, −0.56 points to 1.73 points, includes zero.
B has an 84% chance of being better, which sounds good but leaves a real risk. With 2,400 visitors per version, this test could only expect to find a lift of about 43% or more, 80% of the time. It was too small to settle a gap like this one, so let it run to a planned size.
Planning a headline test
A page converts at 2.8%, and the team wants to find a 15% lift, to 3.22%, with 80% power at 95% confidence. Each version needs 25,976 visitors, 51,952 in total. At 800 visitors a day that takes 65 days.
Aiming for a bolder change, a 30% lift, cuts the need to 6,930 per version and 18 days. Chasing 7.5% instead needs 100,399 per version. Halving the lift roughly quadruples the sample, which is why low-traffic pages should test big changes.
Reading your result
Significant does not mean big. It means a gap this size would be rare if A and B were the same. Read the interval too: if its low end is a gain too small to matter, the change may not be worth shipping.
The two views answer different questions. The p-value asks how surprising the data would be with no real difference. The chance that B beats A asks how likely B is better, given the data and a flat prior. A test can give an 84% chance to win and still be far from significant, as in the second example.
More versions mean more false alarms. Each comparison at 95% confidence has a 5% chance of a false positive. Adobe's guide works through five offers, four compared with the control, and finds an 18.5% chance of at least one false positive. Name one main metric before you start, or test fewer versions.
Common mistakes
- Peeking and stopping early. Evan Miller simulated a test with no real effect that is checked often and stopped at the first significant reading. It reported a winner 26.1% of the time, more than five times the 5% the threshold promises. Fix the sample size first, then read the result once.
- Stopping partway through a week. Weekday and weekend visitors behave differently. Adobe rounds test length up to whole weeks to keep day-of-week effects out of the result.
- Counting sessions instead of people. The test assumes each visitor is counted once and acts on their own. If one person visits ten times, count the person, not the visits.
- Planning for a lift you cannot afford to detect. The headline test needs 65 days for a 15% lift. If your traffic cannot supply the visitors, test a bolder change or a step with a higher rate.
Questions people ask
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods, 7.3.3 How can we determine whether two processes produce the same proportion of defectives?
- Evan Miller, Formulas for Bayesian A/B Testing
- Chris Stucchio, Easy evaluation of decision rules in Bayesian A/B testing
- Select Statistical Consultants, Sample size calculator for comparing two proportions
- Evan Miller, How Not To Run an A/B Test
- Adobe Experience League, How long should you run an A/B test?