Bell Statistics

What is a z-test?

A z-test compares two groups by placing the observed difference on the standard normal curve. In experimentation it is used almost entirely for proportions, where the variance of a rate follows from the rate itself rather than having to be estimated separately.

Notation
z
Also called
two-proportion z-test, normal test, proportion test
Allon Korem

Written by Allon Korem

Chief Executive Officer

Last updated

In plain English

A z-test has the same shape as every other significance test: take the difference you observed, divide it by how much that difference would bounce around under chance alone, and see how far out on a reference curve the result lands. What makes it a z-test rather than a t-test is that the reference curve is the standard normal — the ordinary bell curve — rather than the slightly heavier-tailed t.

The textbook reason for choosing between them is that a z-test applies when the population standard deviation is known and a t-test when it has been estimated from the sample. In practice that distinction decides almost nothing, because the population standard deviation is essentially never known. The reason z-tests are everywhere in experimentation is different and much more specific: for a proportion, the variance is not a separate unknown at all. A conversion rate of p has variance p(1 − p) by construction, so there is nothing left to estimate and nothing to inflate the tails for.

That is why the standard readout on an A/B test of conversion is a two-proportion z-test. Control converted 2,150 of 50,000, variant converted 2,310 of 50,000, and the difference between those two rates is compared against a standard error built from the pooled rate. It is the same arithmetic a chi-square test performs on a two-by-two table — for that specific case the two are algebraically identical, with z² equal to the chi-square statistic — and the choice between them is a matter of which output you would rather read.

The condition that actually matters is whether the normal approximation holds, and it is about counts rather than sample size. The usual rule is at least five expected successes and five expected failures in each arm, with ten being safer. A test with 80,000 users and a 0.004% conversion rate fails that comfortably despite the enormous sample, because it has three conversions. When the counts are that thin the approximation breaks in the direction that matters — it understates how much a rate can move by chance — and Fisher's exact test is the honest answer.

For means rather than proportions the practical advice is simply to use a t-test. At the sample sizes online experiments run at the two are numerically almost indistinguishable, since the t-distribution converges on the normal as degrees of freedom grow, and the t-test is the one that stays correct when the sample turns out smaller than planned.

The formula

The two-proportion version is the one worth committing to memory, because it is what sits behind almost every conversion readout in an experimentation platform.

The general form
z = ( observed difference ) / ( standard error under the null )

Identical in shape to a t statistic. The difference is only which curve the result is compared against.

Two-proportion z-test
z = ( p̂₁ − p̂₂ ) / √( p̂(1 − p̂)( 1/n₁ + 1/n₂ ) )

p̂ is the pooled rate across both arms, used because the null hypothesis says the two rates are equal — see the A/B test sample size calculator.

Variance of a proportion
Var(p̂) = p(1 − p) / n

The reason no separate variance estimate is needed. It is also why conversion tests are least sensitive near p = 0.5 and most sensitive at the extremes.

When the approximation is safe
n · p ≥ 5 and n · (1 − p) ≥ 5, in both arms

Counts, not sample size. Ten is the safer threshold; below five, use Fisher's exact test instead.

Worked example

A pricing page test measures signup rate. Control converted 412 of 18,400 visitors; the variant converted 486 of 18,250. That is 2.24% against 2.66%, an 18.8% relative lift, and the question is whether a gap that size is more than the split alone would produce.

Control
412 / 18,400 = 2.240%
Variant
486 / 18,250 = 2.663%
Pooled rate (p̂)
898 / 36,650 = 2.450%
Standard error
√(0.0245 · 0.9755 · (1/18400 + 1/18250)) = 0.00161
Test statistic
z = 0.00423 / 0.00161 = 2.63
Smallest expected count
412 conversions — comfortably over 5

p = 0.0085, two-sided. The 95% confidence interval on the absolute difference runs from 0.11 to 0.74 percentage points.

A gap this large would appear by chance about once in 118 identical experiments, so the difference is real. Where it needs care is the relative framing: 18.8% sounds transformative, and the interval says the true lift is somewhere between roughly 5% and 33% in relative terms. Both ends are worth having, but a business case built on 18.8% is built on the midpoint of a wide range rather than on a measured quantity. The count condition is met with room to spare here, which is the check that would have mattered had this been a 0.05% conversion rate at the same traffic — there the same arithmetic would have run happily and produced a p-value not worth reading.

Common misconceptions

You use a z-test when the sample is large and a t-test when it is small.
That is a consequence rather than the rule, and following it leads people astray. The real distinction in practice is what you are measuring: proportions get a z-test because their variance is determined by the rate itself, and means get a t-test because theirs has to be estimated. It happens that t converges on z as the sample grows, which is where the folklore comes from — but a large sample of revenue figures still calls for a t-test.
A big sample means the normal approximation is safe.
Not if the events are rare. The condition is on expected COUNTS in each arm, not on the number of users: eighty thousand visitors with three conversions between them fails it badly. In that regime the approximation understates how much a rate can move by chance, so the p-value comes back too small and a false positive is more likely than the number claims.
A significant z-test on conversion means the variant is better for revenue.
It means more people converted, which is a different claim. A variant can lift conversion and lower revenue per user by attracting less committed buyers, and nothing in this test would notice. That is what guardrail metrics are for, and revenue is a mean, so checking it is a t-test rather than another z-test.

Frequently asked questions

How many conversions does a z-test need to be trustworthy?
At least five expected conversions and five expected non-conversions in each arm, with ten being the safer bar. Note that this is about counts rather than visitors, so a test with a very low base rate can fail it despite enormous traffic. Below that threshold the normal approximation understates the variability of a rate, and Fisher's exact test is the right alternative because it works from the exact distribution rather than an approximation to it.
Why does a z-test pool the two conversion rates?
Because the null hypothesis being tested is that both arms share one underlying rate, and the standard error should be computed under the hypothesis being tested. Using the pooled rate is what makes the test consistent with its own null. The unpooled version, which uses each arm's own rate, is the right choice when building a confidence interval around the difference — the two questions genuinely call for different denominators.
Is a z-test different from a chi-square test on the same two groups?
For two groups and a binary outcome they are algebraically the same test: the chi-square statistic is exactly the square of the z statistic, and the p-values match. The practical difference is what they hand back. A z-test gives a signed statistic and a natural confidence interval on the difference in rates, which is what a decision needs. Chi-square generalises to bigger tables, which a z-test cannot do.
Can I run a z-test on revenue per user?
You would be better off with a t-test. Revenue is a mean rather than a proportion, so its variance has to be estimated from the data, and that estimation is precisely what the t-distribution's heavier tails account for. At large sample sizes the two tests give nearly the same answer, so the practical cost is small — but there is no benefit to the z-test here either, and the t-test stays correct if the sample ends up smaller than planned.

Related terms

  • Degrees of freedom

    The count of what is still free to move — and the number that decides how demanding your significance threshold is.

  • One-tailed vs two-tailed test

    The choice that halves your p-value and costs you the ability to see damage — and why it must be made before the data arrives.

  • Statistical significance

    A verdict about evidence, not about importance — and the difference is where most bad decisions live.

  • T-distribution

    The bell curve's cautious cousin — and the reason a small sample needs a bigger result to clear the same bar.

  • T-test

    The workhorse for comparing two averages — and the four assumptions that decide whether its answer means anything.

  • Chi-square test

    The test for counts in a table — the standard SRM check, and the reason expected counts matter more than sample size.

  • Fisher's exact test

    Counts the possible tables instead of approximating them — the right test when a cell expects fewer than five.

  • Conversion rate

    Three arbitrary choices wearing a percentage sign — and the reason two teams report different rates for the same week.

Calculate it

  • One-proportion z-test

    Test one observed rate against a fixed target — an SLA, a benchmark, a contractual floor.

  • A/B test sample size

    Size a two-proportion experiment before you launch, then read the lift and its interval once it lands.

Knowing the term is the easy part

Applying it to a live measurement problem is the part that goes wrong. If you are designing an experiment, reading a result you do not trust, or trying to work out what your marketing actually caused, that is the work we do.

References