One Proportion Z‑Test Calculator

Perform a complete hypothesis test for a single population proportion. Compute the z‑statistic, p‑value, and confidence interval, and visualize the sampling distribution under the null hypothesis. Supports two‑tailed, left‑tailed, and right‑tailed alternatives with adjustable significance level. Ideal for introductory statistics, A/B testing, clinical trials, and survey analysis.

Sample proportion p̂ = x / n
Conditions: n·p₀ ≥ 10 and n·(1−p₀) ≥ 10 for normal approximation (checked automatically).
? Fair coin: x=48, n=100, p₀=0.50, α=0.05, two‑tailed
? Vaccine efficacy: x=82, n=200, p₀=0.70, α=0.01, right‑tailed
⚙️ Defect rate: x=12, n=150, p₀=0.10, α=0.05, left‑tailed
?️ Election poll: x=520, n=1000, p₀=0.50, α=0.05, two‑tailed
? Rare allele: x=3, n=200, p₀=0.02, α=0.05, right‑tailed
Privacy first: All computations are performed locally in your browser. No data is transmitted to any server.

Understanding the One‑Proportion Z‑Test

The one‑proportion Z‑test (also called the one‑sample test for a proportion) is a fundamental statistical procedure used to determine whether the proportion of successes in a single population differs from a hypothesized value. It is the categorical‐data counterpart to the one‑sample t‑test and is widely applied in fields such as public health, political science, market research, quality control, and genetics.

The test relies on the Central Limit Theorem, which states that the sampling distribution of the sample proportion p̂ approximates a normal distribution when the sample size is sufficiently large. The test statistic measures how many standard errors the observed proportion lies from the hypothesized proportion, and the p‑value quantifies the strength of evidence against the null hypothesis.

H₀: p = p₀    vs    Hₐ: p ≠ p₀   (or < or >)

z = (p̂ − p₀) / √(p₀(1−p₀) / n)    where    p̂ = x / n

Under H₀, z ~ N(0, 1) approximately, provided n·p₀ ≥ 10 and n·(1−p₀) ≥ 10.

When to Use This Test

  • Binary outcomes: The response variable must be categorical with exactly two categories (success / failure).
  • Independent observations: Each observation must be independent of the others (random sampling or randomized experiment).
  • Sufficient sample size: The normal approximation is valid when the expected number of successes and failures under H₀ are both at least 10.
  • Fixed hypothesized proportion: The test compares a single sample to a known or hypothesized population proportion p₀.
Case Study: Clinical Trial Efficacy

A pharmaceutical company develops a new drug expected to cure a certain disease in 75% of patients. In a clinical trial with 120 patients, 96 patients are cured (80%). The company wants to test whether the drug's cure rate is significantly higher than the historical standard of 70% (not 75%). The hypotheses are:
H₀: p = 0.70   vs   Hₐ: p > 0.70.
With x = 96, n = 120, p₀ = 0.70, we compute p̂ = 0.80, SE = √(0.70·0.30/120) ≈ 0.0418, z ≈ (0.80−0.70)/0.0418 ≈ 2.39. The right‑tailed p‑value ≈ 0.0084, which is less than α = 0.05, so we reject H₀ and conclude that the drug's cure rate is significantly higher than 70%. This result supports the drug's efficacy and justifies further investigation.

Step‑by‑Step Methodology

1 State the hypotheses — Define H₀: p = p₀ and choose the alternative (two‑tailed, left‑tailed, or right‑tailed) based on the research question.
2 Check conditions — Verify that n·p₀ ≥ 10 and n·(1−p₀) ≥ 10. Also ensure the sample is randomly selected and observations are independent (the 10% condition for sampling without replacement).
3 Compute the test statistic — Calculate p̂ = x/n and the standard error SE = √(p₀(1−p₀)/n), then z = (p̂ − p₀) / SE.
4 Find the p‑value — For a two‑tailed test, p = 2·P(Z ≥ |z|); for left‑tailed, p = P(Z ≤ z); for right‑tailed, p = P(Z ≥ z). Use the standard normal distribution.
5 Make a decision — Compare p to α. If p ≤ α, reject H₀; otherwise, fail to reject H₀. Interpret the result in the context of the problem.

Confidence Interval for the Population Proportion

Alongside the hypothesis test, this calculator provides a (1−α)·100% confidence interval for the true population proportion p, constructed using the Wilson score interval (also called the Wilson interval). The Wilson interval is preferred over the traditional Wald interval because it has better coverage properties, especially for proportions near 0 or 1 and for moderate sample sizes.

Wilson CI:   (p̂ + z²/(2n) ± z·√(p̂(1−p̂)/n + z²/(4n²))) / (1 + z²/n)

The Wilson interval is used by many statistical software packages and is recommended in introductory statistics courses. It is also the default method for confidence intervals for proportions in the binom.test function in R.

Common Misconceptions

  • "p‑value is the probability that H₀ is true." — False. The p‑value is the probability of observing data as extreme as (or more extreme than) the observed data, assuming H₀ is true. It does not give the probability of H₀ itself.
  • "If p ≤ α, the result is practically important." — Statistical significance does not imply practical significance. A very large sample can make even a tiny effect significant. Always consider the effect size and context.
  • "The Z‑test works for any sample size." — The normal approximation requires sufficient sample size. For small n or extreme p₀, the exact binomial test is more appropriate.
  • "A confidence interval that includes p₀ means we accept H₀." — We never "accept" H₀; we either reject or fail to reject it. A CI that includes p₀ is consistent with failing to reject H₀, but the two procedures (test and interval) are complementary, not equivalent.

Real‑World Applications

A/B Testing in Marketing

Compare the conversion rate of a new webpage design against the historical conversion rate. Use a one‑proportion Z‑test to determine if the new design significantly improves conversions.

Election Polling

Test whether a candidate's support exceeds 50% of the electorate. Pollsters use this test to project election outcomes and assess margin of error.

Quality Control

Manufacturers test whether the defect rate of a production process exceeds an acceptable threshold. A left‑tailed test can verify that the defect rate is below a specified limit.

Genetics

Test whether the proportion of individuals carrying a specific allele matches the expected Hardy‑Weinberg proportion in a population.

Exact vs. Approximate Methods

The Z‑test uses a normal approximation to the binomial distribution. When the sample size is small or the hypothesized proportion is extreme (near 0 or 1), the approximation can be poor. In such cases, the exact binomial test (also called the Clopper‑Pearson test) is preferred. This calculator automatically checks the success‑failure condition and warns you if the approximation may be unreliable, guiding you toward using an exact method or collecting more data.

For reference, the exact binomial test computes the p‑value directly from the binomial distribution:
P(X ≥ x) = Σk=xn C(n,k) p₀k (1−p₀)n−k (right‑tailed), with analogous expressions for left‑tailed and two‑tailed tests.

Grounded in statistical theory — This tool implements the one‑proportion Z‑test as described in standard references such as Statistical Inference by Casella & Berger, Introduction to the Practice of Statistics by Moore & McCabe, and the OpenIntro Statistics textbook. The Wilson confidence interval follows the method proposed by E. B. Wilson (1927). The normal curve visualization is rendered using the standard normal density function. Reviewed by the GetZenQuery tech team, last updated June 2026.

Frequently Asked Questions

The one‑proportion Z‑test is specifically for a single proportion (binary outcome) against a hypothesized value. The chi‑square goodness‑of‑fit test can handle multiple categories simultaneously. For a binary outcome, the Z‑test and the chi‑square test are equivalent (the Z‑statistic squared equals the chi‑square statistic).

A common rule of thumb is that n·p₀ ≥ 10 and n·(1−p₀) ≥ 10. Some textbooks use a more conservative threshold of 5. If these conditions are not met, consider using the exact binomial test or collecting a larger sample.

A (1−α)·100% confidence interval provides a range of plausible values for the true population proportion p. If the interval contains p₀, the test result is consistent with not rejecting H₀ (at the α level). The interval also gives a sense of the precision of your estimate — narrower intervals indicate more precise estimates.

If x = 0, the sample proportion is 0, and the Z‑test may still be computed, but the normal approximation is likely poor (especially if n·p₀ is not very small). The calculator will warn you about the condition violation. In such cases, the exact binomial test (or a one‑sided test with continuity correction) is more appropriate.

The standard Z‑test assumes simple random sampling. For complex survey designs (stratified, clustered, or weighted), you should use specialized survey methods that account for the design effect. This calculator is intended for simple random samples or randomized experiments.

Explore resources such as Khan Academy, Penn State STAT 415, and the OpenIntro Statistics textbook. For a deeper dive, consult All of Statistics by Larry Wasserman or Statistical Rethinking by Richard McElreath.
References: Wikipedia: Hypothesis testing; Wilson, E. B. (1927). "Probable Inference, the Law of Succession, and Statistical Inference"; Penn State: One‑Proportion Z‑Test.