statcompute

Hypothesis tests

Z-Test for Proportions Calculator

Compare a proportion against a target value, or two proportions against each other, when the outcome is a simple yes or no.

Also called z test calculator, two-proportion z-test calculator, proportion test calculator.

Updated August 2026Runs in your browser — nothing is uploadedVerified against R
Pick this before seeing the results, not after.
Conventionally 0.05. Decide before you look at the data.

The calculation runs in your browser, so this box needs JavaScript. The formula, the worked example and the interpretation below do not.

01

How to read this result

z counts standard errors. It is the difference between the proportions divided by how much that difference would vary from sample to sample. Beyond about ±1.96 the result is significant at the conventional 5% level.

The test uses the pooled standard error and the interval uses the unpooled one. That is the standard convention rather than an inconsistency: the test assumes the null hypothesis is true, in which case both groups share one underlying proportion; the interval makes no such assumption. It also means a borderline p-value and a borderline interval can disagree very slightly.

Report the difference in percentage points as well as the ratio. A move from 2% to 3% is one percentage point and a 50% relative increase. Both are true; quoting only the flattering one is the most common way conversion results mislead.

For a single proportion, quote the Wilson interval. The textbook Wald interval — p̂ ± z·SE — misbehaves badly near 0 and 1, where it can extend past 100% or below 0%. Wilson stays inside the range and keeps its coverage at small n.

02

The formula

Two proportions

z=p^1p^2p¯(1p¯)(1n1+1n2)p¯=x1+x2n1+n2
p^1,p^2
the two sample proportions
p¯
the pooled proportion, used because the null says they are equal

One proportion

z=p^p0p0(1p0)n

The standard error uses p₀ rather than p̂, again because the test assumes the null hypothesis while computing it.

03

Worked example

Two versions of a sign-up page

Version A is shown to 100 visitors and 45 sign up. Version B is shown to 110 visitors and 30 sign up. 45% against 27.3% looks decisive — but these are small numbers.

  1. Compute both proportions.
    p̂₁ = 45/100 = 0.450 p̂₂ = 30/110 = 0.2727
  2. Pool them, because the null hypothesis says they come from the same population.
    p̄ = 75 / 210 = 0.35714
  3. The pooled standard error of the difference.
    SE = √(0.35714 × 0.64286 × (1/100 + 1/110)) = √0.0043831 = 0.066205
  4. Divide the difference by it.
    z = (0.450 − 0.2727) / 0.066205 = 0.17727 / 0.066205 = 2.678
  5. Two-tailed p-value from the standard normal.
    p = 0.00741
  6. The interval on the difference uses the unpooled standard error.
    95% CI = 4.9 to 30.5 percentage points
z 2.68p 0.0074difference +17.7 pp95% CI 4.9 to 30.5 pp

Significant — but the interval says the true advantage is somewhere between 5 and 30 percentage points. That is a wide range to plan around, and it is what 210 visitors buys you.

Checked against R's prop.test(correct = FALSE).

The calculator above is loaded with these numbers by the Load the worked example button.

04

Assumptions, and when to use something else

  • Independent observations, and independent groups. One visitor, one outcome.
  • Enough successes and failures for the normal approximation. The usual rule is at least 5 — some say 10 — of each in each group. Below that, use Fisher's exact test.
  • A fixed sample size decided in advance. Watching a live experiment and stopping when z crosses 1.96 invalidates the p-value entirely.
  • Small counts in any cellFisher's exact testExact, with no minimum count requirement.
  • You are reading a conversion experimentA/B test calculatorThe same test, framed for experiments: lift, confidence, minimum detectable effect and the peeking warning.
  • The same subjects measured twiceMcNemar's testPaired binary outcomes need a paired test.
  • You need to know how many observations to collectSample size calculatorWorks out n per group from the difference you want to detect.
05

Questions people ask

Is this the same as a chi-square test?

For a 2×2 table, yes: z² equals the chi-square statistic and the two-tailed p-values are identical. The z-test additionally gives you a direction, a difference in percentage points, and a confidence interval for that difference — which is why it is usually the more useful presentation.

Why does the confidence interval use a different standard error from the test?

The test assumes the null hypothesis is true while computing its standard error, so it pools the two groups. The interval makes no such assumption, so it uses the separate estimates. It is the standard convention, and it is why a p-value of exactly 0.05 does not always correspond to an interval that exactly touches zero.

What is the difference between percentage points and percent?

A move from 20% to 25% is five percentage points and a 25% relative increase. Both numbers are reported above. Quoting a relative increase without the baseline is how a change from 0.002% to 0.003% becomes “a 50% rise”.

Can I use this for more than two groups?

Not directly. For several proportions at once, use a chi-square test on the full table, then compare pairs individually with an adjustment for the number of comparisons.