A/B Test Significance, Explained
After reading this you can run a two-proportion z-test on an A/B experiment, compute the p-value and the confidence interval for the difference, and decide whether the lift you see is real or noise.
What this test does
You ran an experiment. Variant A (the control) saw 1000 visitors and 100 converted. Variant B (the change you are testing) saw 1000 visitors and 120 converted. The conversion rates are 10.0% and 12.0%. The variant looks better by 2 percentage points, a relative lift of 20%. The question is whether that gap would survive if you ran the experiment again, or whether it is the kind of wobble you expect from random assignment.
The two-proportion z-test answers exactly that. It measures the observed difference against the amount of sampling noise you would expect if both variants truly converted at the same rate. If the difference is large compared to the noise, the test flags it as statistically significant.
The output has three parts worth reading together: a p-value, the observed lift, and a confidence interval for the true difference in rates. Any one of them alone can mislead you.
When to use it, and when not
Use this test when each visitor lands in exactly one variant, each has a binary outcome (converted or not), and the visitors are independent of each other. That covers most website and email split tests: click or no click, sign-up or no sign-up, purchase or no purchase.
Do not use it in these situations:
- Small counts. If either group has fewer than about 10 conversions or 10 non-conversions, the normal approximation is shaky. Use Fisher's Exact Test instead.
- Paired or matched data. If the same user is measured before and after, the two counts are not independent. Use McNemar's Test.
- More than two variants. Testing A, B and C at once inflates your false-positive rate. A chi-square test handles the overall comparison across the full table.
- A continuous outcome. If you measure revenue per visitor rather than a yes/no event, you want a t-test, not a proportion test.
The formula and the intuition
Let x_A and x_B be the conversions and n_A, n_B the visitors. The sample rates are \hat{p}_A = x_A / n_A and \hat{p}_B = x_B / n_B. Under the null hypothesis both variants share one true rate, so you pool the data to estimate it:
Here \hat{p} is the combined conversion rate ignoring which variant a visitor saw. The pooled rate feeds the standard error, which is the expected size of the random gap between the two sample rates if the null is true:
The z-statistic is the observed difference divided by that noise:
A z of 2 means the gap is twice as large as the typical random gap. The larger |z|, the harder it is to explain the difference by chance. You convert z to a p-value using the standard normal distribution, doubling the tail probability for a two-sided test.
The confidence interval uses a slightly different, unpooled standard error, because the interval describes the actual difference rather than testing a null of zero difference. That is why the interval can occasionally straddle zero even when the p-value sits close to your threshold. The two are computed for two related but distinct purposes.
Worked example with the demo numbers
Load the demo: visitors_a = 1000, conversions_a = 100, visitors_b = 1000, conversions_b = 120.
- Sample rates: \hat{p}_A = 100/1000 = 0.10 and \hat{p}_B = 120/1000 = 0.12.
- Pooled rate: \hat{p} = (100 + 120)/(1000 + 1000) = 220/2000 = 0.11.
- Standard error: SE = \sqrt{0.11 \times 0.89 \times (1/1000 + 1/1000)} = \sqrt{0.0979 \times 0.002} \approx 0.01399.
- z-statistic: z = (0.12 - 0.10)/0.01399 \approx 1.430.
- Two-sided p-value: 2 \times P(Z \gt 1.430) \approx 0.1528.
The absolute difference is 0.02 (2 percentage points), and the relative lift is 0.02 / 0.10 = 20\%. The 95% confidence interval for the difference, using the unpooled standard error \sqrt{0.10 \times 0.90/1000 + 0.12 \times 0.88/1000} \approx 0.01400, is 0.02 \pm 1.96 \times 0.01400, or roughly -0.0074 to 0.0474.
The verdict: with a p-value of 0.15 and an interval that includes zero, this result is not significant at the usual 5% level. The 20% lift looks exciting, but 2000 total visitors are not enough to rule out chance.
See how sample size decides everything
The same 20% relative lift can be noise or a strong signal depending only on how many visitors you collected. Hold the rates at 10% and 12% and grow the samples: the difference stays 2 points but the standard error shrinks like 1/\sqrt{n}, so the z-statistic climbs and the p-value falls.
Reading the results correctly
Three numbers, three jobs:
- p-value
- The probability of seeing a difference at least this large if the two variants truly convert at the same rate. A p-value of 0.15 means noise alone would produce a gap this big or bigger about 15% of the time. Small p-values argue against the null.
- Uplift
- How much better B did, in absolute points (2.0) or relative terms (20%). This is the business number. It is real regardless of significance, but it comes with uncertainty.
- Confidence interval
- The plausible range for the true difference. The interval
-0.0074to0.0474says B could be anywhere from slightly worse to nearly 5 points better. When the interval crosses zero, you cannot rule out no effect.
A significant result (p below 0.05) does not mean a large effect. With 100000 visitors per arm, a difference of 10.0% versus 10.3% is significant but likely too small to matter commercially. Always read the interval next to the p-value. If you only have a z or another statistic in hand, the P-value Calculator converts it.
Common mistakes
The biggest error is peeking. If you check the p-value every day and stop as soon as it dips below 0.05, your real false-positive rate is far above 5%, often 20% or higher. Decide the sample size in advance and test once at the end, or use a method built for sequential testing.
Other traps:
- Confusing relative and absolute lift. A jump from 1% to 2% is a 100% relative lift but only 1 absolute point. State which one you mean.
- Ignoring the practical threshold. Statistical significance is not business significance. Decide beforehand how large a lift would justify shipping the change.
- Unequal group quality. The test assumes visitors were randomized cleanly. If a bug sent all mobile traffic to B, the test is comparing audiences, not designs.
- Treating a non-significant result as proof of no effect. Your example with p = 0.15 does not show the variants are equal. It shows you lack the data to distinguish them.
Related tools on this site
For a 2×2 table with any two categorical outcomes, the Chi-Square Test of Independence gives the same conclusion as this z-test (the chi-square statistic equals z^2 for a 2×2 table). When counts are small, prefer Fisher's Exact Test. To test a single rate against a fixed target rather than compare two, use the One-Proportion Z-Test. If your outcome is a measured amount instead of a yes/no event, move to the t-Test Calculator or, for three or more groups, One-Way ANOVA.
Frequently asked questions
Why is my 20% lift not significant?
Because the sample is small. In the demo, 100 and 120 conversions out of 1000 each give a p-value of 0.15. The relative lift of 20% looks large, but the absolute gap of 2 points is within the range random assignment produces at this size. Roughly 2000 visitors per arm would be needed to call a 10% versus 12% gap significant at the 5% level.
Should I use a one-sided or two-sided test?
Use two-sided unless you decided in advance that only one direction matters and you would ignore a result in the other direction. Two-sided is the safe default and roughly doubles the p-value. In the example, the one-sided p-value would be about 0.076.
How many visitors do I need?
It depends on the baseline rate and the smallest lift worth detecting. As a rough guide, detecting a 10% to 12% shift with 80% power at the 5% level needs about 3800 visitors per arm. Detecting a subtler 10% to 11% shift needs roughly 15000 per arm. Smaller effects demand much larger samples.
What does the confidence interval crossing zero mean?
It means zero difference is a plausible value for the true effect, so you cannot conclude the variants differ. In the demo the 95% interval runs from about -0.7 to +4.7 points, which includes the possibility that B is actually slightly worse.
Can I compare three variants at once with this?
Not directly. Running three pairwise z-tests inflates the chance of a false positive. Test the whole table first with a chi-square test, and if it is significant, follow up with pairwise comparisons adjusted for multiple testing.