Home › Statistics & Probability › Two-Proportion Z-Test Calculator
Two-Proportion Z-Test Calculator
Tests whether two independent proportions differ using the pooled two-proportion z-test and reports the z statistic, two- and one-sided p-values and a Wald confidence interval for the difference.
When to use
You have successes and trials for two independent groups (conversion rates, response rates, defect rates) and want to know whether the rates differ significantly.
Do not use when: Counts are very small (n·p or n·(1 − p) below 5 in a group: use Fisher's exact test), the groups are paired (McNemar's test), or there are more than two groups or categories (use chi-square-test).
Formula
p_a = x_a/n_a, p_b = x_b/n_b, p̂ = (x_a + x_b)/(n_a + n_b); z = (p_a − p_b) / √(p̂(1 − p̂)(1/n_a + 1/n_b)); p = 2(1 − Φ(|z|)); CI = (p_a − p_b) ± z(1 − alpha/2) × √(p_a(1 − p_a)/n_a + p_b(1 − p_b)/n_b)
Normal approximation to the binomial without continuity correction (equivalent to the 2×2 chi-square test without Yates' correction: χ² = z²). The confidence interval uses the unpooled standard error, as is standard.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
successes_a | integer | yes | Number of successes (events) in group A. Range: ≥ 0 | |
trials_a | integer | yes | Number of observations in group A. Range: ≥ 1 | |
successes_b | integer | yes | Number of successes in group B. Range: ≥ 0 | |
trials_b | integer | yes | Number of observations in group B. Range: ≥ 1 | |
alpha | number | default 0.05 | Significance level as a probability (0.05 = 5 %), not a percentage. Confidence intervals and critical values use level 1 − alpha. Range: > 0 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
proportion_a | number | successes_a / trials_a. | |
proportion_b | number | successes_b / trials_b. | |
difference | number | proportion_a − proportion_b. | |
pooled_proportion | number | (successes_a + successes_b) / (trials_a + trials_b), used for the test's standard error. | |
standard_error | number | √(p̂ (1 − p̂) (1/n_a + 1/n_b)). | |
z_statistic | number | difference / standard_error. | |
p_value_two_sided | number | 2 × (1 − Φ(|z|)). | |
p_value_one_sided | number | 1 − Φ(|z|): for the alternative in the observed direction. | |
ci_lower | number | Lower limit of the 100·(1 − alpha) % Wald interval for the difference (unpooled standard error). | |
ci_upper | number | Upper limit of the same interval. | |
significant | boolean | true when p_value_two_sided < alpha. | |
decision | string | Plain-language conclusion of the two-sided test. |
Example
60/200 (30 %) vs 40/200 (20 %): {"successes_a":60,"trials_a":200,"successes_b":40,"trials_b":200} → {"proportion_a":0.3,"proportion_b":0.2,"difference":0.1,"pooled_proportion":0.25,"standard_error":0.0433,"z_statistic":2.3094,"p_value_two_sided":0.020921,"p_value_one_sided":0.010461,"ci_lower":0.0157,"ci_upper":0.1843,"significant":true}
20/100 vs 15/100: {"successes_a":20,"trials_a":100,"successes_b":15,"trials_b":100} → {"difference":0.05,"pooled_proportion":0.175,"z_statistic":0.9305,"p_value_two_sided":0.35212,"ci_lower":-0.0551,"ci_upper":0.1551,"significant":false}
GET https://tttkmbb.com/api/v1/calculate/proportion-z-test?successes_a=60&trials_a=200&successes_b=40&trials_b=200
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/proportion-z-test(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/proportion-z-test · Markdown: https://tttkmbb.com/statistics/proportion-z-test.md · JSON definition: https://tttkmbb.com/statistics/proportion-z-test.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="proportion-z-test" - OpenAPI operationId:
calculate_two_proportion_z_test - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
FAQ
Why does the test use a pooled proportion but the interval does not?
Under H0 both groups share one proportion, so the test pools them for the best estimate of the null standard error; the interval describes the actual difference and therefore uses each group's own variance.
Is this the same as an A/B test significance calculator?
Yes for a two-sided test of conversion rates; z² equals the chi-square statistic of the corresponding 2×2 table without continuity correction.
Related calculators
- Chi-Square Test Calculator — Same comparison as a 2×2 table, or more than two groups.
- Margin of Error Calculator — Confidence interval for a single proportion.
- Sample Size Calculator — Sample size needed for a target margin of error.