HomeStatistics & 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

ParameterTypeUnitRequiredDescription
successes_aintegeryesNumber of successes (events) in group A. Range: ≥ 0
trials_aintegeryesNumber of observations in group A. Range: ≥ 1
successes_bintegeryesNumber of successes in group B. Range: ≥ 0
trials_bintegeryesNumber of observations in group B. Range: ≥ 1
alphanumberdefault 0.05Significance level as a probability (0.05 = 5 %), not a percentage. Confidence intervals and critical values use level 1 − alpha. Range: > 0

Outputs

OutputTypeUnitDescription
proportion_anumbersuccesses_a / trials_a.
proportion_bnumbersuccesses_b / trials_b.
differencenumberproportion_a − proportion_b.
pooled_proportionnumber(successes_a + successes_b) / (trials_a + trials_b), used for the test's standard error.
standard_errornumber√(p̂ (1 − p̂) (1/n_a + 1/n_b)).
z_statisticnumberdifference / standard_error.
p_value_two_sidednumber2 × (1 − Φ(|z|)).
p_value_one_sidednumber1 − Φ(|z|): for the alternative in the observed direction.
ci_lowernumberLower limit of the 100·(1 − alpha) % Wald interval for the difference (unpooled standard error).
ci_uppernumberUpper limit of the same interval.
significantbooleantrue when p_value_two_sided < alpha.
decisionstringPlain-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

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