Bell Statistics

One-proportion z-test calculator

Compare a single observed rate against a number you already have: a service-level target, a published benchmark, a contractual floor. Size the sample first, then get the exact binomial p-value, the z statistic and a Wilson interval once the counts are in. Two measured rates against each other is a different question and belongs in [the A/B test calculator](/calculators/ab-test-sample-size).

Allon Korem

Written by Allon Korem

Chief Executive Officer

Last updated

Calculator

A proportion, so 0.12 is 12%.

The furthest-from-target rate you would still want to catch.

Required sample size
Observations884
Gap it is sized forp₁ − p₀ as a share of the target rate.-25.0%
Achieved powerExact power at the whole n above.82.5%
Normal approximation would sayWhat a z-based calculator returns.857
Effect size (Cohen's h)0.098

Collect 884 observations and the exact binomial test will catch a shortfall to 9.00% against a target of 12.00% about 82.5% of the time. It is sized for that gap and no smaller one: halving the distance between the two rates roughly quadruples the sample, so an audit built to spot three points off target will usually miss one point off target entirely. The figure is the exact test's, which asks for a little more than the normal approximation does because its rejection region is a set of whole counts and cannot spend exactly α.

  • The normal approximation would have said 857. The exact test needs more, because its rejection region is a set of whole counts and cannot use exactly 5.00% of the null.
  • The smallest whole-number sample from which power stays above your target reaches 82.5%; exact power moves in steps, not smoothly.
Sample size observations against statistical powerReaching 0.0% power takes 1 observations and 98.2% takes 1,756; the 80.0% target is met at 884.2004006008001,0001,2001,4001,6000%25%50%75%100%PowerSample size — observations80.0% → 884

Drag the dashed line — or focus it and use the arrow keys — to change the target power and resize the study.

Show these numbers as a table
Power at each sample size observations
PowerSample size
0.0%1
19.2%151
30.8%301
50.3%451
64.1%601
73.8%751
80.7%901
87.9%1,051
91.0%1,201
94.4%1,351
96.5%1,501
97.8%1,651
Required observations against gap from the target rateDetecting 1.2% takes 5,694 and 10.8% takes 45. At the 3.0% currently entered it is 884 — the requirement falls roughly as the square of the effect.1001,0002.0%4.0%6.0%8.0%10.0%Gap from the target rateRequired observations (log scale)3.0% → 884

Drag the dashed line — or focus it and use the arrow keys — to change gap from the target rate.

Show these numbers as a table
Required observations against gap from the target rate
Gap from the target rateRequired observations
1.2%5,694
3.8%551
6.3%181
8.9%83

When to use it

Use a one-proportion test when there is exactly one group and the comparison value is a constant rather than another sample. The distinction sounds pedantic and is not: a fixed target contributes no sampling variability, so all the uncertainty sits in your one estimate. Typical cases are a quality audit against a 99% accuracy commitment, a delivery SLA, a sales team measured against a published benchmark, or a model's precision checked against the threshold written into a contract.

The trap is using it when the comparison number is not actually fixed. If "last quarter's 12%" was itself measured on a sample, it carries its own error, and treating it as known produces a p-value too small and an interval too narrow. Two measured rates want a two-proportion test — or Fisher's exact test if the counts are small, or McNemar's test if the same units were measured on both occasions. Three or more categories at once want a chi-square goodness-of-fit test, which is this test generalised.

If the outcome is a measurement rather than a yes/no — order value against a target, latency against a budget — the equivalent is a one-sample t-test, and the closest thing here is the paired t-test, which is a one-sample t-test on differences under another name. And if the real question is "can we show we are at least as good as the target?", a non-significant result proves nothing; a non-inferiority test states the margin and tests against it.

Assumptions

The list is short, and one item on it does nearly all the work.

  • The sample is random with respect to the thing you are measuring. Auditing the 40 tickets that happened to be open on Friday afternoon gives a precise answer about a population you did not mean to study. No test corrects a sampling frame, and this is where one-proportion tests go wrong far more often than they go wrong on distributional grounds.
  • Observations are independent, with a constant underlying probability. Five hundred emails to one company's domain, or 200 sessions from 40 users, carry far less information than the raw count suggests. Cluster first, then test on the clustered unit.
  • The target was fixed before the data. A threshold picked after seeing where the estimate landed is not a hypothesis, and the p-value against it means nothing.
  • Normality, which this calculator does not need for the primary result. Because the exact binomial p-value is computed directly, small samples and rates near 0 or 1 are handled correctly rather than approximately. The z statistic is shown alongside for comparison with other tools, and the two diverge exactly where the approximation is untrustworthy.

How the calculation works

The primary p-value is exact: the binomial distribution under the null is enumerated and the tail probabilities summed, so there is no approximation to be adequate or otherwise. The two-sided version uses the minimum-likelihood convention — every outcome no more likely than the observed one is counted — which is what R's binom.test does and which differs from twice the one-sided p whenever the null proportion is not 0.5. The z is reported as a secondary statistic and the interval is Wilson's, the inversion of that same score test. That is not a decorative detail: it means interval and verdict always agree, whereas pairing a score test with [a Wald interval](/calculators/proportion-confidence-interval) can give a significant p-value and an interval covering the null on the same data.

Exact binomial p-value (two-sided)
p = Σ { P(X = k) : P(X = k) ≤ P(X = x) }, X ~ Binomial(n, p₀)

Summed over every k from 0 to n no more probable under the null than the observed outcome. When p₀ = 0.5 the distribution is symmetric and this equals twice the one-sided tail; otherwise it does not, and the gap is real rather than a rounding artefact.

Score (z) statistic
z = (p̂ − p₀) / √( p₀(1 − p₀)/n ), p̂ = x/n

The denominator uses p₀, not p̂. Putting the observed proportion there gives the Wald statistic, which behaves visibly worse near 0 and 1 and is not what this reports.

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

The set of null values the score test would not reject. Bounded inside [0, 1] by construction, sensible at zero events, and pulled slightly towards 0.5 — which is the correction, not a bias to undo.

Sample size
n = [ z₁₋α/₂·√(p₀(1−p₀)) + z₁₋β·√(p₁(1−p₁)) ]² / (p₁ − p₀)²

The critical value is set under the null and the power term under the alternative, which is why the two square roots use different proportions. Halving the gap p₁ − p₀ multiplies n by roughly four.

Continuity correction (optional)
z_c = ( |p̂ − p₀| − 1/(2n) ) / √( p₀(1 − p₀)/n )

Shrinks the statistic towards zero to allow for the discreteness of a count. It brings the z-based p-value closer to the exact one at small n, but since the exact value is already computed, it is a convenience for matching other tools rather than an improvement.

Worked example

A client's outbound sequence is supposed to hit the 12% reply rate their agency quoted as the category benchmark. Last quarter 500 prospects received it and 44 replied. Is 8.8% meaningfully short of 12%, or just a quiet quarter?

Successes (x)
44
Sample size (n)
500
Null proportion (p₀)
0.12
Alternative
Two-sided
Significance level (α)
0.05 — a 95% interval

p̂ = 8.8%. Exact binomial p = 0.027; score z = −2.20, normal-approximation p = 0.028. The Wilson 95% interval runs from 6.6% to 11.6%.

The interval excludes 12%, so the shortfall is more than a quiet quarter comfortably explains — but it is wide, spanning everything from a rate barely half the benchmark to one only a whisker below it. The test says nothing about why, and nothing about whether 12% is the right target: it treats that number as a known constant, and if the agency computed it from a few hundred of their own sends it carries error this analysis ignores. Note too that 500 sends was not enough to have counted on catching a shortfall of this size in advance — detecting 9% against a 12% target at 80% power needs 884 by the exact test, or about 857 by the normal approximation the calculator shows beside it. The test cleared the bar because the observed rate landed lower than the design was sized for, which is luck rather than planning.

Interpreting the output

Read the Wilson interval before the p-value. The p-value collapses everything into a comparison against one number; the interval shows the whole range of true rates consistent with what you saw, and against a fixed target it answers the practical question directly — is the target inside the interval or outside it, and if outside, by enough to matter?

A significant result says the true rate is unlikely to equal the target. It says nothing about whether the gap is worth acting on. With 50,000 observations you can separate 11.9% from 12.0% at p < 0.001, and that distinction has no operational meaning. Decide before you run what size of shortfall would trigger a change, then compare the interval against that rather than against 0.05.

A non-significant result is not a clean bill of health. It means the data does not rule the target out, which with a small sample is nearly guaranteed. Look at the width: if the interval stretches from 4% to 30%, the honest report is that the audit was too small to conclude anything. When the question really is "prove we are meeting it", flip it round and use a non-inferiority test, where the burden of proof sits the right way up.

Finally, resist running this test on several targets at once. Checking a dozen SLAs at 5% each gives roughly a one-in-two chance that at least one looks breached when none is — the arithmetic in the problem of multiple comparisons. For the whole picture across categories, a goodness-of-fit test asks the question once. And if the underlying question is whether something caused the shortfall rather than whether it exists, no one-sample test can answer it; that needs a causal design.

Frequently asked questions

Why does the exact p-value differ from the z-test p-value?
Because the count is discrete and the normal curve is not. The z-test approximates a binomial distribution with a smooth one, and the approximation is good when the expected number of successes and failures are both comfortably into double figures, and poor when they are not. With 44 successes out of 500 the two agree to the third decimal, which is why you can trust either. With 4 out of 30 they can differ enough to move a conclusion, and there the exact answer is simply correct — it is computed from the binomial itself rather than from a curve fitted to it.
Why is the two-sided exact p-value not just double the one-sided one?
Doubling only works when the null distribution is symmetric, which for a binomial happens only when the null proportion is exactly 0.5. Otherwise the two tails have different shapes and there is no single obviously right way to combine them. The convention used here, and by R's binom.test, is minimum likelihood: add up the probability of every outcome no more likely than the one you saw. It is coherent, it is what most published analyses use, and it explains why your number may differ in the third decimal from a tool that simply doubles.
My target came from last year's data. Can I still use this test?
Only if last year's figure rests on so much data that its own error is negligible next to your new sample — a rate from a full year of millions of transactions, tested against this month's few hundred. If both numbers come from samples of comparable size, treating one as fixed understates the uncertainty and inflates significance, sometimes badly. In that case use a two-proportion test, which accounts for error in both.
I observed zero successes. What can I conclude?
More than you would think, and the Wilson interval handles it without special pleading. Zero out of 40 gives a 95% interval of roughly 0% to 8.8%: you have not shown the rate is zero, you have shown it is probably below about nine percent. The quick mental version is the rule of three, where the one-sided 95% upper bound for no events in n trials is about 3 divided by n — 7.5% here, in the same neighbourhood. What you must not do is compute a Wald interval, which returns the point zero with zero width and is simply wrong.
How many observations do I need?
It depends far more on the gap you want to detect than on the size of the population. Detecting a rate of 9% against a 12% target at 80% power and 5% two-sided takes 884 observations by the exact test; detecting 6% against the same target takes about 195. Halving the gap you care about roughly quadruples the requirement. If you are sizing an audit rather than a test, work from the interval width you can live with instead — that question belongs in the proportion confidence interval calculator.

Related calculators

  • A/B test sample size

    Size a two-proportion experiment before you launch, then read the lift and its interval once it lands.

  • Proportion confidence interval

    A defensible interval around one rate — Wilson, Agresti-Coull, Jeffreys and Clopper-Pearson, side by side.

  • Correlation test

    Pearson r or Spearman rho, with the Fisher-z interval that says how little a small sample knows.

Terms on this page

  • A/B testing

    A randomised experiment on live traffic — and randomisation is the only part that makes it causal.

  • Sample size

    Four inputs, one number, fixed before the test runs — and the square law that makes small effects expensive.

  • Sample ratio mismatch

    The split is wrong, so the randomisation is broken — the cheapest and most decisive check you can run.

  • Sequential testing

    How to look at a running test without breaking it — and what peeking costs when you do not.

  • Statistical significance

    A verdict about evidence, not about importance — and the difference is where most bad decisions live.

  • Type I error

    The false positive — and the one whose cost lands months later, on a roadmap built around noise.

  • Incrementality

    The conversions that would not have happened anyway — and the gap between that and what platforms report.

Talk to the people who build these for a living

We build measurement that answers the question you asked, with the uncertainty stated rather than rounded away. A/B Testing

References

  • Agresti, A. (2013). Categorical Data Analysis (3rd ed.). Wiley.
  • Brown, L. D., Cai, T. T., & DasGupta, A. (2001). Interval estimation for a binomial proportion. Statistical Science, 16(2), 101-133.
  • Wilson, E. B. (1927). Probable inference, the law of succession, and statistical inference. Journal of the American Statistical Association, 22(158), 209-212.