ForHosting KIT · Developer Utilities

Two-Proportion Z-Test Calculator

This two-proportion z-test calculator compares success rates from two independent samples.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Enter the number of successes and the total sample size for each group, and it returns both observed proportions, the pooled proportion assumed under the null hypothesis, the pooled standard error, the signed z statistic, and a two-sided p-value. The calculation is deterministic and transparent, making it useful for quick analysis, reproducible reports, and automated checks when a normal approximation is appropriate.

Enter counts that describe two independent groups

For each group, provide a success count and the total number of observations. A success is the event you want to compare, such as a purchase, a passed inspection, a survey response, or a patient reaching a predefined endpoint. The success count must be a whole number from zero through its corresponding sample size, and every sample size must be a whole number of at least one. Use the same success definition and observation window for both groups; otherwise, the numerical comparison may look precise while answering an incoherent question. The groups should be independent, meaning that one observation does not occur in both samples and observations are not deliberately paired. For example, separately assigned experiment groups are ordinarily independent, while measurements taken from the same people before and after an intervention are paired and need another method. Enter raw counts rather than rounded percentages. Counts preserve the actual denominators, avoid needless rounding error, and let the calculator derive each observed proportion consistently. The signed comparison is always group one minus group two, so choose the ordering that matches how you plan to describe the result.

Understand the pooled z-test calculation

The null hypothesis says that both population proportions are equal. Under that assumption, successes from the two samples are combined to estimate one pooled proportion: the total successes divided by the total observations. The pooled standard error is the square root of the pooled proportion times one minus that proportion, multiplied by the sum of the reciprocal sample sizes. The z statistic then divides the observed difference, proportion one minus proportion two, by this pooled standard error. A positive z value means the first observed rate is higher, and a negative value means it is lower. The reported p-value is two-sided, so it measures evidence against equality in either direction and is twice the standard-normal tail probability beyond the absolute z value. No continuity correction is applied. When both groups contain only failures or both contain only successes, the pooled standard error is zero and the observed rates are necessarily identical; the calculator reports a neutral z statistic of zero and p-value of one. Returned intermediate values make the arithmetic auditable, and a bounded normal-CDF approximation keeps repeated runs stable without simulation, network requests, or time-dependent data.

Interpret the p-value and check the approximation

A small p-value indicates that a difference at least as extreme as the observed one would be unusual if the two population proportions were truly equal and the sampling assumptions held. It is not the probability that the null hypothesis is true, does not measure the size or practical importance of the difference, and does not by itself establish causation. Review the two observed proportions alongside the z statistic and p-value, and consider reporting a confidence interval or effect size when communicating the result. Before relying on the normal approximation, check that the expected numbers of successes and failures under the pooled null are sufficiently large in both groups. A common working rule asks for each expected count to be at least five, though stricter thresholds may be appropriate. Sparse data, rare outcomes, very small samples, or rates near zero or one can make an exact method such as Fisher's exact test more suitable. Independence and study design remain essential: selection bias, repeated observations, inconsistent outcome definitions, or an unplanned search across many comparisons can invalidate an apparently convincing p-value. The deterministic API costs $0.002 per request and reproduces the same formula, but responsible interpretation still depends on context.

Compare experiment conversion rates

Test whether independently assigned variants show evidence of different purchase or signup proportions.

Contrast defect rates

Compare the proportion of inspected items that fail a consistent quality criterion across two production groups.

Evaluate survey response differences

Assess a binary response measured with the same question in two independently sampled populations.

Is the p-value one-sided or two-sided?

It is two-sided and tests for a difference in either direction.

Why does the test pool the proportions?

The null hypothesis assumes one common population proportion, so the null standard error estimates it by combining successes and observations from both groups.

Which direction does the z statistic use?

It uses proportion one minus proportion two. A positive statistic means the first observed proportion is higher.

Can I enter percentages instead of counts?

No. Enter integer success counts and integer sample sizes so the test retains the real denominators and avoids rounded inputs.

What happens when a sample size is below one?

The request returns an invalid-input error because every group must contain at least one observation.

What does API use cost?

Each API request costs $0.002; the browser calculator can also run the deterministic calculation locally.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/stat/z-test-two-proportions

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/stat/z-test-two-proportions \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"successes_1":56,"size_1":100,"successes_2":42,"size_2":100}'
{
  "successes_1": 56,
  "size_1": 100,
  "successes_2": 42,
  "size_2": 100
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "stat.z_test_two_proportions",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →