Skip to content
Statculator
Hypothesis Tests

Two Proportion Z-Test Calculator

Free two proportion z test calculator (2-prop z test): enter successes and sample sizes for two groups to get z, the p-value, lift, a 95% CI and every step.

Free, no sign-up Runs in your browserBy Hira Noor, BS MathematicsUpdated

Try

Right-tailed asks “is group 1’s rate higher?”. Decide the direction before looking at the results.

Usually 0.05 or 0.01.

Group 1 (e.g. variant B / treatment)

Conversions, yes answers, events…

Visitors, respondents, trials…

Group 2 (e.g. control A)

Off by default, matching textbooks, the TI-84 and statsmodels. Turn it on to match R’s prop.test default; it makes the test slightly more conservative.

Results

z statistic
2.2006
p-value
0.0278
Two-tailed
Relative lift, (p̂₁ − p̂₂) / p̂₂
33.33%

Reject H₀ at α = 0.05

p = 0.0278 ≤ 0.05. At the 5% level there is sufficient evidence that the two population proportions differ.

Group 1 rate, p̂₁
0.064 (6.4%)
Group 2 rate, p̂₂
0.048 (4.8%)
Difference, p̂₁ − p̂₂
0.016 (1.6 points)
Pooled proportion, p̂
0.056
Pooled standard error
0.0073
Critical z (α = 0.05)
±1.96
95% CI for p₁ − p₂
(0.0018, 0.0302)
Cohen’s h
0.0698

Interpretation: Group 1’s rate is 6.4% versus 4.8% for group 2, a difference of 1.6 percentage points (a 33.33% relative increase). A gap this large would be unlikely if the true rates were equal.

normal distribution curve with the shaded probability region, markers at z = 2.201z = 2.201-4-3-2-101234Standard normal distribution (z)
Shaded area: rejection region at the chosen α. Dashed line: your test statistic.

Step-by-step solution

  1. 1

    State the hypotheses

    This is a two-tailed test.

    H₀: p₁ − p₂ = 0
    H₁: p₁ − p₂ ≠ 0
  2. 2

    Choose the significance level

    α = 0.05
  3. 3

    Find each sample proportion

    p̂₁ = x₁ / n₁ = 128 / 2000 = 0.064
    p̂₂ = x₂ / n₂ = 96 / 2000 = 0.048
  4. 4

    Pool the proportions

    Under H₀ the two groups share one proportion, so the best estimate combines both samples.

    p̂ = (x₁ + x₂) / (n₁ + n₂) = (128 + 96) / (2000 + 2000) = 0.056
  5. 5

    Check the success–failure condition

    All four expected counts are at least 10.

    n₁p̂ = 112, n₁(1 − p̂) = 1888
    n₂p̂ = 112, n₂(1 − p̂) = 1888
  6. 6

    Find the pooled standard error

    SE = √[p̂(1 − p̂)(1/n₁ + 1/n₂)] = √[0.056 × 0.944 × (1/2000 + 1/2000)] = 0.0073
  7. 7

    Calculate the test statistic

    z = (p̂₁ − p̂₂) / SE = (0.064 − 0.048) / 0.0073 = 2.2006
  8. 8

    Find the p-value

    Use the standard normal distribution (no continuity correction).

    p = 2 × P(z ≥ |2.2006|) = 0.0278
  9. 9

    Find the critical value

    Critical value: ±1.96
    Reject H₀ if |z| ≥ 1.96
  10. 10

    Decision: reject H₀

    At the 5% level there is sufficient evidence that the two population proportions differ.

    p = 0.0278 ≤ α = 0.05
  11. 11

    Size of the difference

    The confidence interval uses the unpooled standard error, because it does not assume H₀.

    Relative lift = (p̂₁ − p̂₂) / p̂₂ = 0.016 / 0.048 = 33.33%
    95% CI for p₁ − p₂ = 0.016 ± 1.96 × 0.0073 = (0.0018, 0.0302)

What is a Two Proportion Z-Test Calculator?

A two-proportion z-test (also called a 2-prop z test or two-sample z test for proportions) checks whether two independent groups share the same population proportion, such as the conversion rates of two versions of a web page. It pools both samples to estimate the common proportion under H₀, computes z = (p̂₁ − p̂₂) / √[p̂(1 − p̂)(1/n₁ + 1/n₂)] and reads the p-value from the standard normal curve. It is valid when all four expected counts are at least 10.

What the Two Proportion Z-Test Calculator does

This two proportion z test calculator takes the number of successes and the sample size in each group and returns the z statistic, p-value, critical value and decision at your chosen α. It also gives the two sample proportions, the pooled proportion, the relative lift, a 95% two-proportion z interval for p₁ − p₂ and Cohen’s h, checks the success–failure condition, draws the standard normal curve with the rejection region shaded and writes out every step. You can enter counts or sample proportions (as decimals or percentages), and switch on a continuity correction to match R’s prop.test.

It works as a 2 prop z test calculator, a two sample proportion test calculator and an A/B test significance calculator. In an A/B test, put the new variant in Group 1 and the control in Group 2, so a positive difference and lift mean the variant converts better. The same test compares survey proportions between two subgroups, recovery rates under two treatments or defect rates on two production lines.

The test is also known as the 2 proportion z test, the two sample z proportion test, the z test for two proportions and the difference of proportions test. It is not the same as the two-sample z-test for means, which compares averages with known standard deviations. To compare one proportion with a claimed value, use the One Proportion Z-Test Calculator.

How to use the Two Proportion Z-Test Calculator

  1. Choose the alternative hypothesis for p₁ − p₂: two-tailed (≠), left-tailed (<) or right-tailed (>). Pick it from the research question before you look at the results.
  2. Choose how to enter the data: successes and sample sizes, or sample proportions and sample sizes if your problem gives percentages (such as 42% of 500).
  3. Enter the successes x₁ (or p̂₁) and sample size n₁ for Group 1, the variant or treatment. Successes are the “yes” outcomes, such as 128 conversions out of 2,000 visitors.
  4. Enter x₂ (or p̂₂) and n₂ for Group 2, the control. Each success count must be no larger than its sample size.
  5. Set the significance level α, usually 0.05. Some A/B testing programmes use 0.01 or 0.10. Leave the continuity correction off unless you need to match R’s prop.test.
  6. Read z, the p-value and the decision, then the confidence interval for the size of the difference. If the success–failure note appears, use Fisher’s exact test instead.

What is a two-proportion z-test and when do you use it?

A two-proportion z-test is a hypothesis test for the difference between two population proportions. The null hypothesis says the proportions are equal, H₀: p₁ = p₂ (or p₁ − p₂ = 0), and the alternative says they differ, or that one is lower or higher. The test measures how many standard errors apart the two sample proportions are and turns that distance into a p-value.

Use it when all four of these hold:

  • Two independent groups, one yes/no outcome. Each unit is in one group only, and each outcome is a success or a failure.
  • Counts, not averages. You have successes x and sample size n for each group, such as conversions and visitors.
  • Random samples or random assignment. Visitors are split at random in an A/B test, or each group is a random sample from its population.
  • Enough expected successes and failures. n₁p̂, n₁(1 − p̂), n₂p̂ and n₂(1 − p̂) are all at least 10, using the pooled p̂. The calculator checks this for you.

Two-proportion z-test formula (2 prop z test formula)

Sample proportions
p̂₁ = x₁ / n₁, p̂₂ = x₂ / n₂
Pooled proportion
p̂ = (x₁ + x₂) / (n₁ + n₂)
Test statistic
z = (p̂₁ − p̂₂) / √[p̂(1 − p̂)(1/n₁ + 1/n₂)]
p-value
two-tailed: 2·P(Z ≥ |z|) right: P(Z ≥ z) left: P(Z ≤ z)
2-prop z interval
(p̂₁ − p̂₂) ± z(α/2) · √[p̂₁(1 − p̂₁)/n₁ + p̂₂(1 − p̂₂)/n₂]
Relative lift
lift = (p̂₁ − p̂₂) / p̂₂
Conditions
n₁p̂, n₁(1 − p̂), n₂p̂, n₂(1 − p̂) ≥ 10
Formula symbols
SymbolMeaning
x₁, x₂number of successes in each group
n₁, n₂sample sizes
p̂₁, p̂₂sample proportions
p̂pooled proportion (“p pooled”), the estimate of the common p under H₀
z(α/2)two-tailed critical value, 1.96 for 95% confidence
liftchange relative to group 2’s rate

The z statistic for proportions uses the pooled standard error, because the test assumes H₀: p₁ = p₂ is true. The confidence interval uses the unpooled one, because it does not.

By default no continuity correction is applied, matching most textbooks, the TI-84 2-PropZTest and statsmodels’ proportions_ztest. Without the correction, z² equals the chi-square statistic for the 2×2 table. The optional correction (R’s prop.test default) uses z = [|p̂₁ − p̂₂| − ½(1/n₁ + 1/n₂)] / SE, with the sign of p̂₁ − p̂₂.

Sources: NIST/SEMATECH e-Handbook, section 7.3.3: How can we determine whether two processes produce the same proportion of defectives? and the statsmodels proportions_ztest documentation.

Two-proportion z-test example: checkout page A/B test

Does page B convert better than page A?

Problem. The control page (A) converted 96 of 2,000 visitors; the new page (B) converted 128 of 2,000. Is the difference significant at α = 0.05 (two-tailed)? Group 1 = B, Group 2 = A. These are the calculator’s default values, so you can check each step above.

  1. 01Hypotheses: H₀: p₁ = p₂ against H₁: p₁ ≠ p₂ (two-tailed).
  2. 02Rates: p̂₁ = 128 / 2000 = 0.064 and p̂₂ = 96 / 2000 = 0.048.
  3. 03Pooled: p̂ = 224 / 4000 = 0.056. Expected counts (112, 1888, 112, 1888) are all at least 10.
  4. 04SE = √[0.056 × 0.944 × (1/2000 + 1/2000)] = 0.00727.
  5. 05z = (0.064 − 0.048) / 0.00727 = 2.2006; two-tailed p ≈ 0.0278. Critical values are ±1.96, and 2.2006 > 1.96.
  6. 06Relative lift = 0.016 / 0.048 = 33.33%; 95% CI for p₁ − p₂ = (0.0018, 0.0302); Cohen’s h = 0.07.

Answer. p ≈ 0.028 < 0.05, so reject H₀: page B’s conversion rate (6.4%) is significantly different from page A’s (4.8%), and higher. The effect is small (Cohen’s h = 0.07) and the interval is wide: the true gain could be anywhere from about 0.2 to 3.0 percentage points. A right-tailed test (H₁: p₁ > p₂), chosen before seeing the data, would give p ≈ 0.0139.

How to calculate a two-proportion z-test by hand

The calculator follows the same seven steps you would use on paper. Only a standard normal table, such as the z-table, is needed at the end.

  1. State the hypotheses. H₀: p₁ = p₂ and H₁: p₁ ≠, < or > p₂. Choose the direction from the question, not from the data.
  2. Find each sample proportion, p̂₁ = x₁ / n₁ and p̂₂ = x₂ / n₂.
  3. Pool the proportions, p̂ = (x₁ + x₂) / (n₁ + n₂). Under H₀ both groups share one proportion, so the best estimate of it combines both samples.
  4. Check the conditions. Multiply each n by p̂ and by 1 − p̂; all four products should be at least 10.
  5. Find the pooled standard error, SE = √[p̂(1 − p̂)(1/n₁ + 1/n₂)].
  6. Compute the z statistic, z = (p̂₁ − p̂₂) / SE.
  7. Find the p-value and decide. Take the tail area beyond z (double it for a two-tailed test) with a p-value from z calculator, and reject H₀ if p ≤ α, or equivalently if z is beyond the critical value from the Z Critical Value Calculator (±1.96 for a two-tailed test at α = 0.05).

Example 2: survey subgroups (right-tailed)

A survey asks whether people would use a new bus route. In district 1, 45 of 150 respondents say yes; in district 2, 30 of 160 say yes. The planners want to know whether support is higher in district 1. Test H₀: p₁ = p₂ against H₁: p₁ > p₂ at α = 0.05.

  1. p̂₁ = 45 / 150 = 0.3000 and p̂₂ = 30 / 160 = 0.1875.
  2. Pooled p̂ = 75 / 310 = 0.2419. Expected counts are 36.3, 113.7, 38.7 and 121.3, all at least 10. (Load this example with the “Survey groups” button above the calculator.)
  3. SE = √[0.2419 × 0.7581 × (1/150 + 1/160)] = 0.0487.
  4. z = (0.3000 − 0.1875) / 0.0487 = 2.3114.
  5. Right-tailed p-value = P(Z ≥ 2.3114) ≈ 0.0104; critical value 1.6449.
  6. Decision: 2.3114 > 1.6449 and p < 0.05, so reject H₀. Support is higher in district 1, by about 11.3 percentage points (95% CI 1.7 to 20.8 points).

2-proportion z interval for p₁ − p₂

The 2-proportion z interval (2-PropZInt on a TI-84) estimates how far apart the two proportions are, instead of testing whether they are equal: (p̂₁ − p̂₂) ± z(α/2) · √[p̂₁(1 − p̂₁)/n₁ + p̂₂(1 − p̂₂)/n₂]. It uses the separate, unpooled standard error, because it does not assume the proportions are equal.

For the A/B test example, the 95% interval is 0.016 ± 1.96 × 0.00727 = (0.0018, 0.0302). It excludes 0, which agrees with the test rejecting H₀, and shows that the true gain could be anywhere from about 0.2 to 3.0 percentage points. Because the test uses the pooled standard error and the interval the unpooled one, the two can disagree when a result sits right at the cut-off. The Two Proportion Confidence Interval Calculator gives the interval at any confidence level, with the Newcombe method for small samples.

When the success–failure condition fails: use Fisher’s exact test

With small groups or rates near 0% or 100%, the normal curve is a poor fit and the z-test p-value can be far too small. Take 7 of 25 against 2 of 24 (the “Small counts” example in the calculator): the pooled p̂ is 0.1837, so the expected successes are only 4.6 and 4.4, well below 10. The z-test gives z = 1.7773 and a two-tailed p-value of 0.0755, but Fisher’s exact test on the same 2×2 table gives p = 0.1383, almost twice as large.

In that case report the exact result from the Fisher’s Exact Test Calculator. It needs no minimum expected count, because it computes the p-value directly from the hypergeometric distribution.

How to calculate sample size for two proportions

Decide the sample size before the test starts. You need the baseline rate p₂, the smallest rate p₁ worth detecting, α and the power (usually 80%). With the pooled formula, the sample size per group is:

n = [z(α/2)·√(2p̄(1 − p̄)) + z(β)·√(p₁(1 − p₁) + p₂(1 − p₂))]² / (p₁ − p₂)², where p̄ = (p₁ + p₂) / 2.

To detect a lift from 4.8% to 6.4% with a two-tailed α = 0.05 (z = 1.96) and 80% power (z = 0.8416): p̄ = 0.056, so n = [1.96 × 0.3252 + 0.8416 × 0.3250]² / 0.016² = 0.9108² / 0.000256 ≈ 3,241 visitors per group. Small lifts on low baseline rates need large samples; halving the lift roughly quadruples n. The Sample Size Calculator does this for any rates, power and allocation ratio.

2-PropZTest on a TI-84, in R, Python and Excel

The calculator gives the same z and p-value as the common tools, so you can use it to check your work. For the A/B test example (128 of 2,000 against 96 of 2,000):

  • TI-83/TI-84: press STAT, go to TESTS, choose 6:2-PropZTest, enter x1, n1, x2 and n2, pick p1≠p2, <p2 or >p2, then Calculate: z = 2.2006, p = 0.0278. For the interval, choose B:2-PropZInt.
  • R: prop.test(c(128, 96), c(2000, 2000), correct = FALSE) gives X-squared = 4.8426, which is z² = 2.2006², and p = 0.0278. Without correct = FALSE, R applies a continuity correction and reports X-squared = 4.5447 and p = 0.0330; tick “Apply continuity correction” above to get the same z = 2.1318 and p-value here.
  • Python: statsmodels’ proportions_ztest(count=[128, 96], nobs=[2000, 2000]) uses the pooled standard error and returns z = 2.2006 and p = 0.0278.
  • Excel or Google Sheets: compute z in a cell, then =2*(1-NORM.S.DIST(ABS(z),TRUE)) for a two-tailed p-value or =1-NORM.S.DIST(z,TRUE) for a right-tailed one.

How to report a two-proportion z-test

Give both proportions with their counts, the z statistic, the p-value and the confidence interval for the difference, and say whether the test was one- or two-tailed. For the A/B test example, in APA style:

“A two-tailed two-proportion z-test showed that page B’s conversion rate (6.4%, 128 of 2,000) was higher than page A’s (4.8%, 96 of 2,000), z = 2.20, p = .028. The difference was 1.6 percentage points, 95% CI [0.2, 3.0], a relative lift of 33%.”

If you applied a continuity correction, say so, because it changes z and the p-value.

Two-proportion z-test vs two-sample z-test and other tests

Yes, there is a two-sample z-test, but the name covers two tests. The two-sample z-test for means compares averages when both population standard deviations are known; the two-proportion z-test compares rates from counts, and its standard error comes from the pooled proportion. Pick by the data you have:

TestDataNull hypothesisDistribution
Two-proportion z-test (this page)Successes out of n in two independent groupsp₁ = p₂Standard normal
Two-sample z-testMeans of two groups, known σ₁ and σ₂μ₁ = μ₂Standard normal
One-proportion z-testSuccesses out of n in one groupp = p₀Standard normal
Fisher’s exact test2×2 table with small expected countsp₁ = p₂Hypergeometric
Chi-square test of independenceCounts in any r × c tableRows and columns independentChi-square

Common use cases

  • A/B tests of conversion, click-through, sign-up or churn rates.
  • Comparing the share who agree with a statement in two survey subgroups.
  • Clinical comparisons of response or side-effect rates between two treatments.
  • Comparing defect or failure rates between two suppliers, shifts or machines.
  • Checking homework or an AP Statistics 2-PropZTest worked by hand or on a TI-84.

Assumptions and limitations

  • Independent groups: each user or unit appears in one group only. Repeated yes/no measurements on the same people (before and after) need McNemar’s test instead.
  • Success–failure condition: all four expected counts n₁p̂, n₁(1 − p̂), n₂p̂ and n₂(1 − p̂) should be at least 10 (some books accept 5). For small counts use the Fisher’s Exact Test Calculator.
  • No peeking: in A/B testing, checking the p-value repeatedly and stopping as soon as it dips below α inflates false positives. Fix the sample size in advance, or use a sequential method designed for repeated looks.
  • Significance is not size. With large samples, a tiny difference can be significant. Report the difference, the lift and the confidence interval, not just the p-value.
  • Two groups only. For more than two groups or outcome categories, use the Chi-Square Test of Independence Calculator.

Frequently asked questions

How do you calculate a two-proportion z-test?

Find p̂₁ = x₁/n₁ and p̂₂ = x₂/n₂, then the pooled proportion p̂ = (x₁ + x₂)/(n₁ + n₂). The standard error is √[p̂(1 − p̂)(1/n₁ + 1/n₂)], and z = (p̂₁ − p̂₂)/SE. Get the p-value from the standard normal distribution and reject H₀ if p ≤ α. For 128 of 2,000 against 96 of 2,000, z = 2.2006 and the two-tailed p-value is 0.0278.

Is there a 2-sample z-test?

Yes. The two-sample z-test for means compares two averages when both population standard deviations are known. The two-proportion z-test, also called the 2-sample z test for proportions, compares two rates from counts of successes. Both use the standard normal distribution.

How do you calculate sample size for two proportions?

Choose the baseline rate, the smallest difference worth detecting, α and the power. Per group, n = [z(α/2)·√(2p̄(1 − p̄)) + z(β)·√(p₁(1 − p₁) + p₂(1 − p₂))]² / (p₁ − p₂)², where p̄ is the average of the two rates. Detecting a rise from 4.8% to 6.4% at α = 0.05 with 80% power needs about 3,241 per group.

How do I know if my A/B test result is statistically significant?

Run a two-proportion z-test on the conversions and visitors of each version. If the p-value is at or below the α you chose before the test (commonly 0.05), the difference is statistically significant. Also check the confidence interval for the difference, which shows whether the gain is large enough to matter.

Why does the two-proportion z-test use a pooled proportion?

The null hypothesis says both groups have the same proportion, so the standard error is computed under that assumption, using the combined estimate p̂ = (x₁ + x₂)/(n₁ + n₂). Confidence intervals for the difference do not assume equality and use the separate p̂₁ and p̂₂ instead.

What is relative lift?

Relative lift is the difference in rates divided by the baseline rate, (p̂₁ − p̂₂)/p̂₂. Going from 4.8% to 6.4% is a 1.6 percentage-point absolute increase but a 33.3% relative lift. Report both, because relative lift can sound large when baseline rates are small.

Is the two-proportion z-test the same as a chi-square test?

Yes, for a 2×2 table without continuity correction. The chi-square statistic equals z², and the chi-square p-value equals the two-tailed z p-value. The z-test also allows one-tailed hypotheses and gives a signed difference.

When should I use Fisher’s exact test instead?

Use Fisher’s exact test when any expected count n₁p̂, n₁(1 − p̂), n₂p̂ or n₂(1 − p̂) is below 10, which happens with small groups or rates near 0% or 100%. For 7 of 25 against 2 of 24, the z-test gives p = 0.0755 but Fisher’s exact test gives p = 0.1383.

Cite this page

Statculator. (2026, November 14). Two Proportion Z-Test Calculator. Retrieved November 14, 2026, from https://statculator.com/hypothesis-tests/two-proportion-z-test-calculator/