Proportion z test calculator: one and two-sample

By Jude Wallis · Published

A proportion z test checks whether a sample proportion, or the gap between two, differs from a claim. A one-sample test builds its standard error from the null value p0; a two-sample test uses a pooled proportion, p-hat-c. Then z = (statistic - parameter) / SE.

one-proportion z-test

z = 2.4, p = 0.0164

Large counts under H0: np0 = 50, n(1 - p0) = 50 (both at least 10, condition met).

Steps

  1. 1.p-hat = 62 / 100 = 0.62
  2. 2.SE under H0 = sqrt(p0(1 - p0)/n) = sqrt(0.5 x 0.5 / 100) = 0.05
  3. 3.z = (p-hat - p0) / SE = (0.62 - 0.5) / 0.05 = 2.4
  4. 4.p-value = 0.0164

AP Statistics: Unit 3 (topics 3.5 Setting Up a Test for a Population Proportion, 3.7 Carrying Out a Test for a Population Proportion, 3.12 Setting Up a Test for the Difference Between Two Population Proportions, 3.13 Carrying Out a Test for the Difference Between Two Population Proportions). These one and two-proportion z-tests are Unit 3 topics in the Fall 2026 AP Statistics course, part of the Inference for Categorical Data section.

What the proportion z test calculator does

This proportion z test calculator runs a hypothesis test for a proportion using a z statistic. Choose one sample to test a single proportion against a claimed value, or use the two proportion z test calculator to compare two groups.

A few symbols show up throughout. p^\hat{p} (p-hat) is the sample proportion, the count of successes divided by the sample size nn. p0p_0 (p-naught) is the null value, the proportion the null hypothesis claims. zz is the standardized test statistic, which the formula sheet defines as (statistic - parameter) divided by the standard error of the statistic.

One-proportion z test: standard error under the null

For a one-sample test, the null hypothesis fixes the true proportion at p0p_0, so the standard error is built from p0p_0, not from your sample:

SE=p0(1p0)nSE = \sqrt{\frac{p_0(1-p_0)}{n}}

The test statistic compares your sample proportion to the claim:

z=p^p0p0(1p0)nz = \frac{\hat{p} - p_0}{\sqrt{\frac{p_0(1-p_0)}{n}}}

Using p0p_0 here is the key detail. A confidence interval for the same data would use p^\hat{p} in the standard error, but a test assumes the null is true, so the null value sets the spread.

Two-proportion z test: the pooled proportion

For a two-sample test, the null hypothesis says the two population proportions are equal, p1=p2p_1 = p_2. When you assume they are equal, the best estimate of that shared value combines both samples into a pooled proportion, written p^c\hat{p}_c (p-hat-c, the combined proportion):

p^c=n1p^1+n2p^2n1+n2\hat{p}_c = \frac{n_1\hat{p}_1 + n_2\hat{p}_2}{n_1 + n_2}

That is just the total successes over the total sample size. The pooled value then feeds the standard error for both groups:

SE=p^c(1p^c)(1n1+1n2)SE = \sqrt{\hat{p}_c(1-\hat{p}_c)\left(\frac{1}{n_1} + \frac{1}{n_2}\right)}

and the two proportion z test statistic is:

z=p^1p^2SEz = \frac{\hat{p}_1 - \hat{p}_2}{SE}

This pooling only happens for the test. A confidence interval for the difference keeps the two sample proportions separate in the standard error.

Checking conditions with expected counts

Two conditions let the sampling distribution of the statistic be close to Normal, so a z test applies.

  • Random: the data come from a random sample or a randomized experiment.
  • Large counts: the expected numbers of successes and failures are each at least 10.

For one sample, the expected counts under the null are np0np_0 and n(1p0)n(1-p_0). For two samples, use each sample's own proportion: n1p^1n_1\hat{p}_1, n1(1p^1)n_1(1-\hat{p}_1), n2p^2n_2\hat{p}_2, and n2(1p^2)n_2(1-\hat{p}_2) should each be at least 10. When you sample without replacement, each sample should also stay under 10% of its population.

How to use the calculator

  1. Choose one sample or two samples.
  2. Enter the successes and the sample size for each group. The tool finds p^\hat{p} for you.
  3. For one sample, type the null value p0p_0.
  4. Pick the alternative hypothesis: two-sided (\ne), less than (<<), or greater than (>>).
  5. Read off the standard error, the z statistic, and the p-value.

The calculator also reports the expected counts so you can confirm the large-counts condition at a glance.

Reading z and the p-value

The z statistic counts how many standard errors separate your result from the null. A zz of 2.4 means the sample proportion sits 2.4 standard errors above the claimed value.

The p-value is the probability of a z at least that extreme if the null were true. For a two-sided test, double the tail area. Compare the p-value to your significance level (often 0.05): a smaller p-value is evidence against the null. A large p-value never proves the null true; it just fails to give evidence against it.

One-proportion z test: 62 of 100 versus p0 = 0.5

A coin is flipped 100 times and lands heads 62 times. Test whether the coin is fair (p0=0.5p_0 = 0.5) against the two-sided alternative that it is not, at the 0.05 level.

  1. Sample proportion: p^=62/100=0.62\hat{p} = 62/100 = 0.62.

  2. Check conditions: the flips are random, and the expected counts under the null are np0=100(0.5)=50np_0 = 100(0.5) = 50 and n(1p0)=100(0.5)=50n(1-p_0) = 100(0.5) = 50, both at least 10.

  3. Standard error under the null: SE=0.5(0.5)100=0.0025=0.05SE = \sqrt{\frac{0.5(0.5)}{100}} = \sqrt{0.0025} = 0.05.

  4. Test statistic: z=0.620.50.05=0.120.05=2.4z = \frac{0.62 - 0.5}{0.05} = \frac{0.12}{0.05} = 2.4.

  5. P-value: the upper tail is P(Z2.40)0.0082P(Z \ge 2.40) \approx 0.0082, so the two-sided p-value is 2×0.0082=0.01642 \times 0.0082 = 0.0164.

  6. Compare: 0.0164<0.050.0164 < 0.05.

z=2.4z = 2.4 and the two-sided p-value is 0.01640.0164. Since 0.0164<0.050.0164 < 0.05, reject the null hypothesis; there is convincing evidence the coin is not fair.

Two-proportion z test: comparing two groups

In group 1, 30 of 50 people say yes; in group 2, 20 of 50 say yes. Test whether the two population proportions differ, at the 0.05 level.

  1. Sample proportions: p^1=30/50=0.60\hat{p}_1 = 30/50 = 0.60 and p^2=20/50=0.40\hat{p}_2 = 20/50 = 0.40.

  2. Pooled proportion: p^c=30+2050+50=50100=0.50\hat{p}_c = \frac{30 + 20}{50 + 50} = \frac{50}{100} = 0.50.

  3. Check conditions: observed counts n1p^1=30n_1\hat{p}_1 = 30, n1(1p^1)=20n_1(1-\hat{p}_1) = 20, n2p^2=20n_2\hat{p}_2 = 20, and n2(1p^2)=30n_2(1-\hat{p}_2) = 30, all at least 10.

  4. Standard error: SE=0.5(0.5)(150+150)=0.25×0.04=0.01=0.1SE = \sqrt{0.5(0.5)\left(\frac{1}{50} + \frac{1}{50}\right)} = \sqrt{0.25 \times 0.04} = \sqrt{0.01} = 0.1.

  5. Test statistic: z=0.600.400.1=0.200.1=2.0z = \frac{0.60 - 0.40}{0.1} = \frac{0.20}{0.1} = 2.0.

  6. P-value: the upper tail is P(Z2.00)0.02275P(Z \ge 2.00) \approx 0.02275, so the two-sided p-value is 2×0.02275=0.04552 \times 0.02275 = 0.0455.

z=2.0z = 2.0 and the two-sided p-value is 0.04550.0455. Since 0.0455<0.050.0455 < 0.05, reject the null hypothesis; there is convincing evidence the two proportions differ.

Frequently asked questions

When do you use the pooled proportion in a two-proportion z test?

You pool only for the two-proportion significance test, because its null hypothesis assumes the two population proportions are equal. Combining both samples gives the best estimate of that single shared proportion. A confidence interval for the difference does not pool; it keeps p^1\hat{p}_1 and p^2\hat{p}_2 separate in the standard error.

Why does the one-sample test use p0 instead of p-hat in the standard error?

A hypothesis test assumes the null hypothesis is true, and the null fixes the proportion at p0p_0. So the standard error is p0(1p0)/n\sqrt{p_0(1-p_0)/n}, built from the claimed value. This differs from a confidence interval, which has no assumed value and uses p^\hat{p} instead.

How do you get the p-value from z?

Find the tail area beyond your z under the standard Normal curve. For a one-sided test that tail area is the p-value; for a two-sided test, double it. For example, z=2.4z = 2.4 gives an upper tail of about 0.0082 and a two-sided p-value of 0.0164.