Quick answer
A z-test is a hypothesis test whose statistic follows the standard normal distribution when the null hypothesis is true. It is valid when the standard error is known or samples are large, which is why A/B calculators run a two-proportion z-test; for means with an estimated σ, use a t-test.
Formula: Two-proportion: z = (p1 − p2) ÷ √(p(1 − p)(1/n1 + 1/n2)), p = (x1 + x2) ÷ (n1 + n2); one-sample: z = (x̄ − μ0) ÷ (σ ÷ √n)
What is a z-test?
A z-test is a hypothesis test whose test statistic follows the standard normal distribution when the null hypothesis is true. You compute how many standard errors the observed difference sits away from the value the null hypothesis predicts, then read the p-value from the normal curve instead of from a t, chi-square or exact distribution.
That last part is the whole point. A z-test is only as valid as the claim that the statistic is (approximately) normal with a known standard error. That claim holds in three common situations:
- the population standard deviation is genuinely known, for example from a long-running process or a calibrated instrument;
- the sample is large enough that the estimated standard error is practically exact;
- the data are proportions (conversions out of visitors), where the standard error follows from the proportion itself and the normal approximation to the binomial works once counts are reasonably large.
The third case is the one most marketers and product teams meet without knowing it: most conversion-rate A/B calculators run a two-proportion z-test under the hood.
Types of z-test and their formulas
| Type | Question it answers | Statistic |
|---|---|---|
| One-sample z-test (mean) | Is this sample mean different from a reference value μ0? | z = (x̄ − μ0) ÷ (σ ÷ √n) |
| Two-sample z-test (means) | Do two groups have different means? | z = (x̄1 − x̄2) ÷ √(σ1²/n1 + σ2²/n2) |
| One-proportion z-test | Is this rate different from a reference rate p0? | z = (p̂ − p0) ÷ √(p0(1 − p0) ÷ n) |
| Two-proportion z-test | Do two groups convert at different rates? | z = (p̂1 − p̂2) ÷ √(p̂(1 − p̂)(1/n1 + 1/n2)) |
In the two-proportion test, p̂ is the pooled proportion, (x1 + x2) ÷ (n1 + n2). Pooling is used because the null hypothesis says both groups share one true rate, so the best estimate of that rate uses all the data. The NIST/SEMATECH e-Handbook gives exactly this statistic for comparing two proportions and notes that it relies on the normal approximation to the binomial, so it needs reasonably large samples; for small samples it points to Fisher's exact test instead.
Worked example: a two-proportion z-test on an A/B test
Sample data: a checkout page test splits traffic evenly. Control converts 480 of 10,000 visitors (4.80%); the variant converts 552 of 10,000 (5.52%). The question is whether a 0.72-point gap is larger than chance would produce.
- Pooled proportion: p̂ = (480 + 552) ÷ 20,000 = 1,032 ÷ 20,000 = 0.0516.
- Standard error under the null: √(0.0516 × 0.9484 × (1/10,000 + 1/10,000)) = √(0.0000097874) = 0.003128.
- z statistic: (0.0552 − 0.0480) ÷ 0.003128 = 0.0072 ÷ 0.003128 = 2.30.
- p-value: the two-sided p-value for z = 2.30 is 0.021 (0.011 one-sided).
- Decision: at α = 0.05 the two-sided critical value is 1.96, and 2.30 > 1.96, so the difference is statistically significant.
- Size of the effect: the unpooled standard error is also 0.003128, so the 95% confidence interval for the lift is 0.0072 ± 1.96 × 0.003128 = 0.11 to 1.33 percentage points. The relative lift is 5.52 ÷ 4.80 − 1 = 15%, but the interval says the true gain could be as small as a tenth of a point.
Step 6 is where most write-ups stop too early. A significant z only says the difference is unlikely to be zero; the interval tells you whether it is worth shipping. See this statistical significance example for how to read the two together.
Critical values you will actually use
The decision rule is "reject the null when |z| is larger than the critical value." The values below come from the standard normal table (NIST e-Handbook, section 1.3.6.7.1: the area from 0 to 1.96 is 0.4750, so 2.5% sits in each tail).
| Significance level α | Two-sided critical z | One-sided critical z |
|---|---|---|
| 0.10 | 1.645 | 1.282 |
| 0.05 | 1.960 | 1.645 |
| 0.01 | 2.576 | 2.326 |
Decide one-sided or two-sided before looking at the data. Switching to a one-sided test after the variant "looks better" halves the p-value without any new evidence.
Z-test vs t-test: which one to use
A t-test has the same shape as a one- or two-sample z-test, but it estimates the standard deviation from the sample and pays for that uncertainty with heavier tails. The t distribution approaches the normal as degrees of freedom grow. The NIST table of t critical values (two-sided, α = 0.05) shows how fast:
| Degrees of freedom | t critical value | Gap to z = 1.960 |
|---|---|---|
| 5 | 2.571 | +0.611 |
| 10 | 2.228 | +0.268 |
| 30 | 2.042 | +0.082 |
| 100 | 1.984 | +0.024 |
| ∞ | 1.960 | 0 |
The difference matters only when samples are small. Sample data: 11 orders after a pricing change average $54 against a historical $49, with a sample standard deviation of $8. The statistic is (54 − 49) ÷ (8 ÷ √11) = 2.07. Read as a z, the two-sided p-value is 0.038 and you would reject the null. Read correctly as a t with 10 degrees of freedom, the critical value is 2.228 and the p-value is 0.065: not significant. Same data, opposite conclusion.
A practical rule:
- Proportions with large counts (both groups with at least a few dozen conversions and non-conversions): two-proportion z-test.
- Means with an estimated standard deviation: t-test, whatever the sample size. With hundreds of observations the answer matches the z-test anyway, so nothing is lost.
- Small counts of conversions: Fisher's exact test, not z.
- Known σ: z-test. In web analytics this almost never happens; revenue per visitor, session length and order value all need t.
Assumptions and common mistakes
- Independence. Each visitor must count once and belong to one group. If the unit is the visitor but you count sessions, repeat visitors inflate n and shrink the standard error. Count unique visitors in both numerator and denominator.
- Peeking. Running the z-test every day and stopping on the first p below 0.05 raises the real false-positive rate well above 5%. Fix the sample size first, or use a sequential method designed for repeated looks.
- Small counts. A 3-versus-9 conversions comparison does not meet the normal approximation. Use an exact test.
- Many metrics. Testing ten metrics at α = 0.05 gives a good chance that one is "significant" by luck. Name one primary metric in advance.
- Bots in the denominator. Automated traffic adds visitors who never convert, which lowers both rates and can blur a real difference.
- Confusing significance with importance. With 1,000,000 visitors per group, a 0.05-point difference can produce z above 3. Report the interval and decide whether that size of effect matters; see practical vs statistical significance.
Running the numbers with TapCub data
TapCub does not split traffic or run A/B tests, and it does not compute significance. It can supply the four counts the z-test needs if your testing tool records which variant each visitor saw. Using the checkout example above:
- Send the variant with both events. When the testing tool assigns a variant, fire an event such as
experiment_viewwith a propertyvariantset toAorB, and add the samevariantproperty to thepurchaseevent. - Create one goal per count. In Web analytics › Goals, an event goal can carry a property condition (equality only). Make four goals:
experiment_viewwherevariant = A, the same forB, andpurchasewherevariant = Aandvariant = B. The goals table shows distinct visitors who completed each goal: the two exposure goals are n1 and n2, the two purchase goals are x1 and x2. - Check the path. A funnel from
experiment_viewtopurchasein All-platform analytics › Behavior › Behavior analysis confirms that buyers were exposed before they bought. Funnels count distinct people by default, the same unit as the goals. - Keep bots out. Recognised bots and AI crawlers go to Web analytics › Bots and are not counted as visitors, so they do not dilute either denominator.
- Compute z yourself. Put the four numbers into the formula above or a spreadsheet; a result like 480/10,000 vs 552/10,000 gives z = 2.30 and p = 0.021.
Sources
- NIST/SEMATECH e-Handbook of Statistical Methods, 7.3.3 How can we determine whether two processes produce the same proportion of defectives? (two-proportion z statistic, large-sample condition, Fisher's exact test for small samples).
- NIST/SEMATECH e-Handbook, 1.3.6.7.1 Cumulative distribution function of the standard normal distribution (area 0 to 1.96 = 0.4750).
- NIST/SEMATECH e-Handbook, 1.3.6.7.2 Critical values of the Student's t distribution (2.571, 2.228, 2.042, 1.984, 1.960 at 0.975).
Was this explanation clear?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Data Analyst
Explores traffic sources, conversion funnels, and retention, using clear metric definitions and concrete examples to explain what the numbers mean.