Statistics & probability

Exact binomial test calculator with two-sided p-value

Test one binomial proportion using exact probability ordering for two-sided inference or a selected inclusive one-sided tail.

Your numbers

Use a decimal with at most six places or a fraction such as 1/2. Scientific notation is not accepted.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

An exact binomial test evaluates an observed success count under a specified null success probability and fixed trial count. For the two-sided calculation, this page includes every count with null probability no greater than the observed count’s probability. One-sided modes instead sum the selected inclusive count tail. Exact integer weights decide tail membership, including mathematical ties, before a logarithmic floating conversion produces display values.

THE FORMULATwo-sided p = Σ P₀(X=j) over all j with P₀(X=j) ≤ P₀(X=k).

A worked example

With ten trials, eight successes and p0=0.5, counts 0,1,2,8,9,10 are included in the probability-ordered two-sided tail. Their binomial weights sum to 112 out of 1,024 equally likely binary sequences, so p=0.109375. The greater alternative instead includes 8,9,10 and gives 56/1,024=0.0546875. These are different hypotheses, not interchangeable rounding choices.

Good to know

Supports 1–500 independent trials with the same fixed success probability. Null probability input has bounded exact decimal/fraction precision. The sample size and alternative must be chosen according to the design; optional stopping is not handled. A p-value does not provide an effect size, equivalence conclusion or confidence interval. Very small positive values may display zero while their finite log p-value remains available.

Two-sided discrete inference needs an explicit ordering rule

For a symmetric null distribution, doubling the smaller one-sided tail often agrees with probability ordering. For a skewed binomial null, it need not. The table marks each count that contributes to the selected p-value so that the convention can be inspected directly. Counts on opposite sides of the mean are included according to their probability, not simply their equal distance in success-count units.

Exact integer comparisons avoid deciding that theoretically tied masses are different because one was rounded a little higher. A finite decimal null probability is interpreted literally, while a fraction such as one third preserves that exact rational value. This concerns the stated mathematical model; it does not make an estimated or guessed null probability scientifically exact. Report the null and tail rule alongside the result.

Filled probability markers identify the two-sided exact binomial tailProbability-ordered tail; n = 10012345678910
With n = 10, k = 8 and p0 = 1/2, counts 0,1,2,8,9,10 have probability no greater than count eight. Their exact weights sum to 112/1024 = 0.109375. Open markers are excluded.

The Sequential probability ratio test calculator for Bernoulli trials uses predeclared sequential boundaries. This exact binomial page assumes a fixed sample size.

An unlikely observation is not the probability that the null is true

The calculation assumes the null model and asks how much probability lies in the selected set of outcomes. It does not reverse that conditioning to assign a probability to the hypothesis itself. The observed success proportion is returned separately to retain a description of the outcome. Practical importance depends on the context and the size of a difference, not only on whether a threshold is crossed.

Trials must be independent and share the same success probability under the model. Repeatedly checking a fixed-sample p-value and stopping when it becomes small changes the experiment. The sequential probability-ratio calculator provides a different workflow for two predeclared Bernoulli hypotheses and its own stopping rule. It should not be presented as permission to apply arbitrary optional stopping to this fixed-sample test.

A few questions, answered

What if p0 is zero but a success occurs?

That observation has zero probability under the literal null. The selected impossible-event tail can have p=0, distinct from a tiny positive value lost during display conversion.

Is this the same as the binomial probability calculator?

No. A binomial PMF returns the mass of one count. This test aggregates an explicitly defined set of outcomes to calculate an inferential p-value.

Find your calculator

Start typing to explore the library.