Every test starts with a null hypothesis, and if you have used our A/B test hypothesis template, you have already written one: “the new design makes no difference.” The p-value is the number that tells you how awkward your data is for that claim. Get p value AB testing basics wrong, and you will ship changes that never earned their win, or kill ones that did.
Below, we take one store’s test from raw order counts to a final p-value, pick the right test for each metric (z, t or chi-square), and look at when a one-sided test is fair rather than a shortcut.
What a P-Value Actually Means in an A/B Test
A p-value answers one narrow question. If the variant truly had zero effect, how often would random assignment alone produce a gap at least as large as the one you observed?
That is all it says. A p-value of 0.03 does not mean there is a 97% chance the variant is better. It does not measure how big the lift is, and it says nothing about whether the test was set up correctly. It is a measure of surprise under the “no difference” assumption, nothing more.
The American Statistical Association’s 2016 statement on p-values makes the same point in its six principles: a p-value does not measure the probability that a hypothesis is true, and a decision should never rest on whether it crossed 0.05 alone. For a broader primer on confidence levels and the 95% convention, see our guide to statistical significance in A/B testing.
In practice, we treat the p-value as a gate. Before launch, you pick a significance level, called alpha, usually 0.05. Once the test reaches its planned sample, you compare p to alpha. If p is below alpha, you reject the null. If not, you have not proven the variants are equal; you just lack evidence that they differ.
AB Testing P Value Formula: A Worked Conversion-Rate Example
Let’s use a real-looking case. A skincare store tests a new product page layout for 14 days, with 12,000 visitors on each version. The old page turns 360 of them into orders, a 3.00% rate. The new one gets 420, or 3.50%.
So the variant is up half a point, a 16.7% relative lift. Is it real? That is the job of the AB testing p value formula for two conversion rates, and it is easier with actual numbers.
First, pool the two rates. If the null hypothesis is right, both pages share one true conversion rate, so our best guess for it is all orders over all visitors: 780 / 24,000, which is 0.0325.
Next comes the standard error of the difference, basically how much the gap would wobble from random assignment alone. SE = sqrt(p_pool * (1 – p_pool) * (1/n_A + 1/n_B)), which here lands at 0.002289.
Now divide the observed gap by that wobble: 0.005 over 0.002289 gives a z-score of about 2.18.
The last bit is turning z into a p-value. For a two-sided test, p = 2 * (1 – Phi(|z|)), where Phi is the standard normal cumulative distribution. Plug in 2.18 and you get 0.029.
In plain terms, if the new layout did nothing, a gap of 0.5 points or more, in either direction, would show up only about 2.9% of the time. That is under our alpha of 0.05, so the result is statistically significant.
The NIST Engineering Statistics Handbook shows the same two-proportion z statistic. In Python, statsmodels.stats.proportion.proportions_ztest([420, 360], [12000, 12000]) returns z = 2.18 and p = 0.029.
Read more: Minimum Detectable Effect (MDE) Explained for Ecommerce
Read Your Test Results With Confidence
Plan sample size before launch, track significance on real orders, and avoid stopping too early. Try CustomFit.ai free for 14 days.
Z Test vs T Test: AB Testing Conversion and Revenue Metrics
The z test vs t test AB testing question is mostly settled by the type of metric you are comparing, not by personal taste.
Use a z test for conversion rates
Conversion rate is a yes or no outcome per visitor. With thousands of visitors per arm, order counts follow a near-normal distribution, so the two-proportion z test above is the standard choice. It is reliable when each arm has at least 10 conversions and 10 non-conversions.
Use a t test for revenue per visitor and order value
Revenue per visitor (RPV) and average order value are continuous and heavily skewed. Most visitors spend $0, and a few spend $300. Here, use Welch’s t test, which does not assume both groups have equal variance.
Same skincare test, now on RPV. Suppose the average order is $80 with a standard deviation of $60 in both arms.
That puts control RPV at $2.40 (3.00% x $80), with a per-visitor standard deviation of $17.15, while the variant comes in at $2.80 (3.50% x $80) with $18.50.
The standard error is sqrt(17.15^2 / 12,000 + 18.50^2 / 12,000) = $0.230. The t statistic is 0.40 / 0.230 = 1.74, with about 23,860 degrees of freedom. The two-sided p-value is 0.082.
This is the part many teams miss. The same test is significant on conversion rate (p = 0.029) but not on revenue per visitor (p = 0.082), because order values add noise. At this sample size, t and z give nearly identical answers, so what matters is which metric you named as primary before launch. If revenue is your primary metric and it keeps landing just above 0.05, CUPED variance reduction can cut that noise using pre-experiment spend.
Chi-Square Test for AB Testing (and Why It Matches the Z Test)
The chi-square test for AB testing works on a contingency table of counts. For our two-variant conversion test, that is a 2×2 table:
| Group | Orders | No order | Visitors |
| Control | 360 | 11,640 | 12,000 |
| Variant | 420 | 11,580 | 12,000 |
| Total | 780 | 23,220 | 24,000 |
If there were no difference, each arm would expect 390 orders and 11,610 non-orders. The chi-square statistic sums (observed – expected)^2 / expected across all four cells:
chi-square = 900/390 + 900/390 + 900/11,610 + 900/11,610 = 2.308 + 2.308 + 0.078 + 0.078 = 4.770
Now square the z-score from earlier: 2.184^2 = 4.770. Same number. For any 2×2 table, the Pearson chi-square statistic (without continuity correction) equals z squared, and with one degree of freedom it gives the same p-value of 0.029.
Chi-square earns its place when you have more than two arms (an A/B/C/D test is a 4×2 table) or more than two outcome categories. It is also the test behind a sample ratio mismatch check. When any expected cell count is below 5, switch to Fisher’s exact test.
| Metric or setup | Recommended test | Notes |
| Conversion rate, 2 variants | Two-proportion z test or 2×2 chi-square | Identical p-values |
| Conversion rate, 3 or more variants | Chi-square on a k x 2 table | Follow up with corrected pairwise tests |
| Revenue per visitor, AOV | Welch’s t test | Consider CUPED or capping extreme orders |
| Very small samples | Fisher’s exact test | Use when expected counts fall below 5 |
One Sided vs Two Sided AB Test: When One Tail Is Acceptable
A two-sided test asks whether the variant is different, better or worse. A one-sided test asks only whether it is better. The one sided vs two sided AB test choice changes the p-value by a factor of two.
Take a smaller version of the test: 10,000 visitors per arm, 300 orders vs 345 orders. That gives z = 1.80. The two-sided p-value is 0.072, which misses 0.05. The one-sided p-value is 0.036, which clears it. Same data, opposite verdicts.
That is why one-sided tests have a bad reputation. Picking the tail after seeing the data quietly doubles your false positive rate.
There are fair uses, though. A one-sided test is acceptable when all three of these hold:
- You chose it before launch and wrote it in the test plan.
- You would take the same action whether the variant is flat or worse, for example a cheaper design you only ship if it clearly wins.
- You do not need to detect harm, or you track harm separately with guardrail metrics like refund rate.
The payoff is real. To detect a lift from 3.0% to 3.5% at 80% power, a two-sided test needs about 19,740 visitors per variant, while a one-sided test needs about 15,550, roughly 21% fewer. Our A/B test sample size formula guide shows both versions of the calculation.
Our default is two-sided. For a checkout or pricing change, you want to know if the variant hurts, and a one-sided test cannot tell you that.
P Value AB Testing Mistakes We See Most Often
Most bad calls in p value AB testing come from process, not math.
- Checking every day and stopping at the first p below 0.05. Repeated looks inflate the false positive rate well past 5%. The peeking problem in A/B testing explains how sequential methods fix this.
- Testing many metrics and reporting the one that worked. With 20 independent metrics at alpha 0.05, the chance of at least one false positive is 1 – 0.95^20 = 64%. Name one primary metric before launch.
- Reading p = 0.06 as “almost significant.” It is not significant at the threshold you chose. Either run to a larger planned sample in a new test, or accept the result as inconclusive.
- Treating a tiny p-value as a big effect. With 500,000 visitors per arm, a 0.1 point lift (3.0% to 3.1%) reaches p = 0.004 and may still not cover the cost of the change. Always report the lift and its confidence interval next to p.
Checklist Before You Report a P-Value
- Write down alpha, the primary metric and one-sided or two-sided before launch.
- Hit the planned sample size and run at least two full weeks.
- Run an SRM check on visitor counts first.
- Match the test to the metric: z or chi-square for conversion, Welch’s t for revenue.
- Report the p-value, the absolute and relative lift, and a 95% confidence interval together.
Run Tests You Can Defend to Your Team
Start with a clear primary metric, a fixed sample size and honest significance tracking. Try CustomFit.ai free for 14 days, no credit card required.
Summary
A p-value tells you how surprising your data would be if the variant had no effect. For conversion rates, use the two-proportion z test or a 2×2 chi-square, which agree because chi-square equals z squared. For revenue per visitor, use Welch’s t test. Stay two-sided by default, and read p alongside the lift and confidence interval, never on its own.
FAQs
What is a good p-value in A/B testing?
For most stores, 0.05 is the line. Anything under it is treated as significant, which is the same as saying you are working at 95% confidence. High-risk changes such as pricing or checkout often use 0.01 instead. A p-value is only meaningful if the test reached its planned sample size and nobody stopped it early.
What is the AB testing p value formula for conversion rates?
Pool the two conversion rates, compute the standard error as sqrt(p_pool x (1 – p_pool) x (1/n_A + 1/n_B)), divide the difference in rates by that standard error to get z, then convert z to a p-value with the normal distribution. For a two-sided test, p equals 2 x (1 – Phi(|z|)).
Should I use a one sided vs two sided AB test?
Use a two-sided test by default, because it detects both wins and losses. A one-sided test is acceptable only when you choose it before launch, would act the same way if the variant were flat or worse, and track harm with guardrail metrics. It needs about 21% fewer visitors for the same power.
Z test vs t test in AB testing: which one fits my metric?
Use a two-proportion z test for yes or no metrics such as conversion rate or add-to-cart rate. Use Welch’s t test for continuous metrics such as revenue per visitor or average order value. With thousands of visitors per variant, both give nearly the same p-value, so the metric type is what decides it.
Is a chi-square test for AB testing the same as a z test?
For a simple two-variant conversion test, yes. The Pearson chi-square statistic on a 2×2 table equals the z-score squared and gives the same p-value. Chi-square becomes more useful when you compare three or more variants at once or check traffic splits for sample ratio mismatch.



