How to calculate statistical significance for an A/B test
Compare the two conversion rates with a two-proportion z-test. The calculator does it in five steps:
- Work out each conversion rate: conversions divided by visitors, for A and for B.
- Pool the two groups: p = total conversions / total visitors. This is the best estimate of the rate if the versions were really the same.
- Work out the standard error: the square root of p x (1 - p) x (1 / visitors A + 1 / visitors B).
- Divide the difference in rates by the standard error. That is the z-score.
- Convert the z-score to a two-sided p-value using the normal distribution.
The result is significant when the p-value is below 1 minus your confidence level: below 0.05 for 95% confidence, below 0.01 for 99%.
What the p-value means
The p-value is the chance of seeing a gap at least this large if the two versions truly performed the same. A p-value of 0.0278 means a difference this big would turn up about 2.78% of the time from random variation alone.
It is not the chance that B is better, and it is not the chance that the result is wrong. It only says how surprising the data would be if nothing had changed. A low p-value makes "nothing changed" hard to believe. A high one means the test cannot tell the versions apart yet.
Why sample size decides the verdict
The same uplift can be significant or not depending on how many visitors saw each version. Each row below has a 5% rate for A and a 5.7% rate for B, a 14% relative uplift.
| Visitors per version | Conversions A | Conversions B | Z-score | P-value | Significant at 95%? |
|---|---|---|---|---|---|
| 1,000 | 50 | 57 | 0.7 | 0.4867 | No |
| 5,000 | 250 | 285 | 1.56 | 0.1199 | No |
| 10,000 | 500 | 570 | 2.2 | 0.0278 | Yes |
| 20,000 | 1,000 | 1,140 | 3.11 | 0.0019 | Yes |
A test that is not significant has not proved the versions are equal. It has only failed to gather enough evidence. Small differences on low traffic pages can take a long time to confirm, which is a reason to test bigger changes there.
How to read the result
Read the verdict together with the size of the change. Significant means the gap is probably real, not that it is large enough to matter. A 0.1 point lift can be significant on a huge sample and still not be worth shipping. Check the relative change against what the change costs to build and maintain.
Use the conversion rate calculator to check the rates themselves, and see the glossary entry on A/B testing for how to set a test up.
Common mistakes
- Stopping when the result first turns significant. P-values swing early in a test. Checking daily and stopping at the first value below 0.05 produces false winners far more often than the confidence level suggests. Set the sample size in advance and read the result once.
- Choosing the confidence level afterwards. Dropping from 95% to 90% because the result just missed is deciding the answer first.
- Testing many variants or metrics at once. Each extra comparison is another chance for a false positive. With several variants, use a stricter level.
- Ignoring unequal conditions. Both versions have to run over the same dates with visitors split at random. A week of A followed by a week of B is not an A/B test.
- Counting visits instead of visitors. The test assumes each observation is independent. One person counted five times is not five people.