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
- 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.
- 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).
- 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.
- Enter x₂ (or p̂₂) and n₂ for Group 2, the control. Each success count must be no larger than its sample size.
- 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.
- 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)
| Symbol | Meaning |
|---|---|
| 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 |
| lift | change 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.
- 01Hypotheses: H₀: p₁ = p₂ against H₁: p₁ ≠ p₂ (two-tailed).
- 02Rates: p̂₁ = 128 / 2000 = 0.064 and p̂₂ = 96 / 2000 = 0.048.
- 03Pooled: p̂ = 224 / 4000 = 0.056. Expected counts (112, 1888, 112, 1888) are all at least 10.
- 04SE = √[0.056 × 0.944 × (1/2000 + 1/2000)] = 0.00727.
- 05z = (0.064 − 0.048) / 0.00727 = 2.2006; two-tailed p ≈ 0.0278. Critical values are ±1.96, and 2.2006 > 1.96.
- 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.
- State the hypotheses. H₀: p₁ = p₂ and H₁: p₁ ≠, < or > p₂. Choose the direction from the question, not from the data.
- Find each sample proportion, p̂₁ = x₁ / n₁ and p̂₂ = x₂ / n₂.
- Pool the proportions, p̂ = (x₁ + x₂) / (n₁ + n₂). Under H₀ both groups share one proportion, so the best estimate of it combines both samples.
- Check the conditions. Multiply each n by p̂ and by 1 − p̂; all four products should be at least 10.
- Find the pooled standard error, SE = √[p̂(1 − p̂)(1/n₁ + 1/n₂)].
- Compute the z statistic, z = (p̂₁ − p̂₂) / SE.
- 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.
- p̂₁ = 45 / 150 = 0.3000 and p̂₂ = 30 / 160 = 0.1875.
- 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.)
- SE = √[0.2419 × 0.7581 × (1/150 + 1/160)] = 0.0487.
- z = (0.3000 − 0.1875) / 0.0487 = 2.3114.
- Right-tailed p-value = P(Z ≥ 2.3114) ≈ 0.0104; critical value 1.6449.
- 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:
| Test | Data | Null hypothesis | Distribution |
|---|---|---|---|
| Two-proportion z-test (this page) | Successes out of n in two independent groups | p₁ = p₂ | Standard normal |
| Two-sample z-test | Means of two groups, known σ₁ and σ₂ | μ₁ = μ₂ | Standard normal |
| One-proportion z-test | Successes out of n in one group | p = p₀ | Standard normal |
| Fisher’s exact test | 2×2 table with small expected counts | p₁ = p₂ | Hypergeometric |
| Chi-square test of independence | Counts in any r × c table | Rows and columns independent | Chi-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?
Is there a 2-sample z-test?
How do you calculate sample size for two proportions?
How do I know if my A/B test result is statistically significant?
Why does the two-proportion z-test use a pooled proportion?
What is relative lift?
Is the two-proportion z-test the same as a chi-square test?
When should I use Fisher’s exact test instead?
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/