Skip to content

Binomial Test Calculator

Enter the number of successes, the number of trials, and the probability you want to test against, and get the exact binomial p-value for all three alternatives, the Clopper–Pearson confidence interval, the Wilson interval for comparison, and Cohen's h as an effect size. The binomial distribution under your null hypothesis is tabulated so you can see which outcomes make up the p-value. Free, no sign-up.

A value between 0 and 1, such as 0.5 or 0.25.

Enter the number of successes, the number of trials, and p₀.

How to Use the Binomial Test Calculator

  1. 1. Enter the counts. Type the number of successes (k) and the number of trials (n). A success is whichever outcome you are counting — a head, a correct answer, a respondent who agrees.
  2. 2. Enter p₀. This is the probability of success under your null hypothesis: 0.5 for a fair coin, 0.25 for a four-option guess, or a published benchmark.
  3. 3. Choose the alternative and confidence level. Two-sided asks whether the true probability differs from p₀ in either direction; the one-sided choices ask about one direction only.
  4. 4. Read the result. The exact p-value, the confidence interval for the true probability, and the null distribution table appear below. Copy the APA line when you are done.

How the Exact Binomial Test Works

If every trial is independent and succeeds with the same probability p₀, the number of successes X follows a Binomial(n, p₀) distribution: P(X = j) = C(n, j) p₀j (1 − p₀)n−j. The one-sided p-values are simple tails — P(X ≤ k) for "the probability is less than p₀" and P(X ≥ k) for "greater". There is no approximation, so the test is valid for any n, including very small samples and probabilities near 0 or 1, where a normal-approximation z-test breaks down.

The two-sided p-value needs care. Doubling the smaller tail is correct only when p₀ = 0.5, because only then is the distribution symmetric. This calculator uses the rule of R's binom.test and SciPy's binomtest: add up the probability of every outcome that is no more likely than the one you observed. The table marks those outcomes so you can see exactly what was counted. For a symmetric null it equals twice the smaller tail.

The confidence interval for the true probability is the Clopper–Pearson (exact) interval, built from beta-distribution quantiles. It guarantees at least the stated coverage, so it errs on the wide side. The Wilson score interval is shown alongside because it is narrower and has coverage close to nominal. For a one-sided alternative the exact interval is one-sided too, as in R.

Worked Example: Testing a 30% Benchmark

Click Try an example to load a survey in which 61 of 150 respondents chose an option that a published benchmark says 30% of people choose. The observed proportion is p̂ = .407; the expected count under H₀ is 45.

Exact binomial test, step by step

X ~ Binomial(150, 0.3); P(X = 61) = 0.001418

Outcomes no more likely than 61: 0–29 and 61–150 → two-sided p = .0056

One-sided: P(X ≥ 61) = .0035; P(X ≤ 61) = .998

95% Clopper–Pearson CI [.327, .490]; Cohen's h = 0.22

In APA style: more respondents chose the option than the 30% benchmark, 61 of 150 (p̂ = .41), exact binomial test against p₀ = .30: p = .006, 95% CI [.33, .49]. The interval excludes .30, in agreement with the test, and h = 0.22 is a small-to-medium effect by Cohen's rule of thumb (0.2 small, 0.5 medium, 0.8 large).

Binomial Test or Another Test?

SituationBetter choice
One proportion, any sample sizeExact binomial test
Large sample, np₀ and n(1 − p₀) both at least 10Normal approximation (one-proportion z-test), which agrees closely
Two independent proportionsTwo-proportion z-test, or Fisher's exact test for small counts
Paired yes/no outcomesMcNemar's test, which is a binomial test on the discordant pairs
Counts across three or more categoriesChi-square goodness of fit

Frequently Asked Questions

What is the binomial test used for?
It tests whether the proportion of successes in a sample is consistent with a hypothesised probability — for example, whether a coin is fair, whether a pass rate matches a target, or whether the share of people choosing an option differs from a benchmark. It works for any sample size because it uses exact binomial probabilities.
When should I use the binomial test instead of a z-test?
Use it whenever the sample is small or p₀ is near 0 or 1, i.e. when np₀ or n(1 − p₀) is below about 10, since the z-test's normal approximation is unreliable there. With a large sample the two give nearly the same answer, but the exact test is never wrong, so there is little reason to prefer the approximation.
Why is the two-sided p-value not simply double the one-sided one?
Doubling works only if the null distribution is symmetric, which happens when p₀ = 0.5. For any other p₀ the distribution is skewed, and the outcomes in the opposite tail that are as unlikely as yours are not a mirror image of your own. The standard method sums the probabilities of every outcome no more likely than the one observed.
How do I report a binomial test in APA style?
State the counts and the test, the hypothesised probability, the exact p-value, and the interval: 61 of 150 (p̂ = .41), exact binomial test against p₀ = .30: p = .006, 95% CI [.33, .49]. Italicise p and p̂, and drop the leading zero from proportions that cannot exceed 1.
Which confidence interval should I report?
The Clopper–Pearson interval pairs naturally with the exact test and guarantees at least the nominal coverage, but it is conservative. The Wilson interval is shorter and has coverage closer to the nominal level, and is a good choice for reporting a proportion. Whichever you pick, say which it is.
What assumptions does the binomial test make?
That each trial has exactly two outcomes, that the trials are independent, that the probability of success is the same on every trial, and that the number of trials was fixed in advance. Sampling without replacement from a small population violates independence; the hypergeometric distribution is the right model then.

Related Tools

More in Statistics Calculators

See all Statistics Calculators