Skip to content
CalculatorZilo Logo
  • Home
  • CalculatorsExpand
    • Browse all calculators
    • Education
    • Real Estate
    • Chemistry
  • Finance
  • Math
  • Health & Fitness
  • Science
  • About
  • Contact
CalculatorZilo Logo
Home / Math Calculators / Negative Binomial Calculator
Probability Calculators

Negative Binomial Calculator

Published onOctober 13, 2025 Updated onOctober 23, 2026 7:03 am

The negative binomial distribution answers a waiting question: how many failures should you expect before the r-th success, or how many trials will that take in total? This calculator handles both parameterizations in one place. Enter the number of successes r, the success probability p per trial, and a target, and it returns the exact probability, all four cumulative tails, the mean, variance, standard deviation, mode, skewness and excess kurtosis, plus a probability chart and table you can audit row by row.

Negative Binomial Calculator
PMF, all four CDF tails, mean, mode and shape statistics in both parameterizations
Distribution results
Exact probability:
P(X ≤ target):
P(X < target):
P(X ≥ target):
P(X > target):
Mean:
Variance:
Standard deviation:
Mode (most likely k):
Skewness:
Excess kurtosis:

The chart and table are drawn in failures (k) terms even in trials mode, because the table is the audit trail for the cumulative sums. At p = 1 the wait is certain, so skewness and excess kurtosis are undefined and print as a dash. Extremely large parameter combinations (for example r = 1000 with k = 500) overflow double-precision arithmetic inside the binomial coefficient, and the exact and cumulative probabilities print as a dash there too; the mean and variance still compute.

Quick Answer

Flip a fair coin (p = 0.5) until the 3rd head (r = 3): the chance of seeing exactly 2 tails first (k = 2) is 0.1875 (18.75%), and the chance of 2 or fewer tails is 0.5. On average you wait through 3 failures (6 total flips), and 2 failures is also the single most likely outcome. In trials mode the same event is n = 5, because Y = X + r.

Key takeaways

  • The negative binomial fixes the success count r and lets the trial count vary. The binomial distribution does the opposite, which is the whole difference between the two.
  • Failures and total trials are the same event in two notations: Y = X + r. A textbook answer in one notation converts to the other by adding or subtracting r, with the probability unchanged.
  • At r = 1 the distribution is exactly the geometric distribution: failures before the first success, with P(X = k) = (1 − p)k × p.
  • The distribution is always right-skewed for valid inputs, so the mean sits above the mode: plan around the mean for averages, and around the cumulative tails for guarantees.
On this page
  • Quick Answer
  • How to use the negative binomial calculator
  • The negative binomial formulas
  • Worked example: the third head on the fifth flip
  • Reading the shape statistics
  • Negative binomial vs binomial vs geometric
  • What competing calculators miss
  • Frequently asked questions
  • Add This Calculator to Your Website
  • References

How to use the negative binomial calculator

Pick a parameterization, enter r, p and a target, then click Calculate. The results stay hidden until you do.

  1. Choose the parameterization that matches your question. Failures mode evaluates k, the failures seen before the r-th success. Trials mode evaluates n, the trial on which the r-th success arrives. Switching modes relabels the target field, and switching back and forth never changes a probability: the same event gives the same number in both modes.
  2. Enter r, a positive whole number. r is a count of successes, so 2.5 is rejected with a plain message rather than silently rounded. Some textbooks and software packages allow a real-valued r through a gamma-function generalization; this tool deliberately uses the counting model, where r is a number of successes you can point at.
  3. Enter p as a decimal between 0 and 1. p = 1 is allowed and means success is certain on every trial: the exact probability of 0 failures is 1, the mean wait is 0, and skewness and excess kurtosis print as a dash because a distribution with no spread has no shape statistics.
  4. Enter the target. k runs from 0 to 2000 in failures mode; in trials mode n must be at least r. Read the exact probability first, then the four cumulative tails, and use the verdict line and the green chart bar to see whether your target sits in the likely region or out in the tail.

One honest limit: the binomial coefficient is computed with ordinary double-precision arithmetic, so extreme combinations such as r = 1000 and k = 500 overflow and the exact and cumulative probabilities print as a dash. Ordinary textbook and applied ranges, up to r and k in the low hundreds, compute exactly; the checks table below includes r = 100 so you can verify that claim yourself.

The negative binomial formulas

In failures form, P(X = k) = C(k + r − 1, k) × pr × (1 − p)k. The coefficient counts the orderings of the first k + r − 1 trials that hold k failures and r − 1 successes, and the final trial is then forced to be the r-th success. This is the same formulation used in the NIST/SEMATECH e-Handbook of Statistical Methods, and the coefficient itself is the ordinary binomial coefficient evaluated at (k + r − 1, k).

Failures: P(X = k) = C(k+r−1, k) · pr · (1−p)k
Trials: P(Y = n) = C(n−1, r−1) · pr · (1−p)n−r, with Y = X + r
Mean = r(1−p)/p failures  |  Variance = r(1−p)/p2  |  Mode = floor((r−1)(1−p)/p), or 0 when r = 1
Skewness = (2−p) / sqrt(r(1−p))  |  Excess kurtosis = (6 + p2 − 6p) / (r(1−p))

Cumulative probabilities are honest sums: P(X ≤ k) adds the PMF term by term from 0 up to k, and the other three tails come from that sum and its complement. P(X < k) is the sum up to k − 1, P(X ≥ k) is 1 minus that, and P(X > k) is 1 minus P(X ≤ k). Software cross-checks agree with this arithmetic: R’s dnbinom and pnbinom functions use the same failures parameterization, so dnbinom(2, size = 3, prob = 0.5) returns the same 0.1875 as the worked example here.

1. Count failures first: X = k→ 2. Add the r successes: Y = k + r→ 3. Same probability, trials wording: P(Y = n) with n = k + r

Worked example: the third head on the fifth flip

A fair coin is pre-filled in the calculator: r = 3, p = 0.5, k = 2. That setup is also the natural home of this distribution, since waiting-for-heads questions are a special case of the coin flip probability family where the number of flips is not fixed in advance.

Running it gives P(X = 2) = C(4, 2) × 0.53 × 0.52 = 6 × 0.125 × 0.25 = 0.1875. The cumulative to the left builds from the table: P(X = 0) = 0.125, P(X = 1) = 0.1875, P(X = 2) = 0.1875, so P(X ≤ 2) = 0.125 + 0.1875 + 0.1875 = 0.5000. The mean is 3 × 0.5 / 0.5 = 3 failures, which is 6 total flips; the variance is 6 and the standard deviation 2.44949. The mode formula gives floor(2 × 0.5 / 0.5) = 2, so the target is also the single most likely wait, and the skewness is (2 − 0.5) / sqrt(3 × 0.5) = 1.2247.

Five more runs of this same calculator, covering the geometric special case, a low-p long tail and a large-r check, are tabulated below. Type any row in and you will get the same figures back.

Inputs (mode, r, p, target)P(X = target)P(X ≤ target)Mean failuresMode
Failures, r = 3, p = 0.5, k = 2 (worked example)0.18750.532
Trials, r = 3, p = 0.5, n = 5 (same event)0.18750.532
Failures, r = 1, p = 0.3, k = 4 (geometric case)0.072030.831932.3333330
Failures, r = 5, p = 0.25, k = 70.043017270.157643681512
Failures, r = 10, p = 0.9, k = 00.348678440.348678441.1111111
Failures, r = 100, p = 0.5, k = 1000.028174240.5281742410099

Hand-check the r = 5 row the slow way: C(11, 7) = 330 orderings, times 0.255 = 0.0009765625, times 0.757 = 0.13348389, gives 0.04301727. The mode for that row, floor(4 × 0.75 / 0.25) = 12, sits below the mean of 15, which is the right skew doing exactly what the skewness figure of 0.9037 says it should.

Reading the shape statistics

The mode is the single most likely failure count; the skewness and excess kurtosis describe how lopsided and heavy-tailed the wait is. Skewness here is always positive, so most waits finish quickly while a long right tail of slow runs pulls the mean upward.

That gap between mode and mean is the practical number. For r = 5 and p = 0.25 the most likely outcome is 12 failures, the average is 15, and P(X ≤ 7) is only 0.1576: a plan built on “about 7 failures” fails roughly five times out of six. If you need a wait that holds 95% of the time, read down the calculator’s probability table until the cumulative column crosses 0.95 and budget for that k instead of the mean. This is the same habit you would use with any discrete probability distribution: the PMF tells you what is likely, the CDF tells you what is safe.

Negative binomial vs binomial vs geometric

The three distributions share Bernoulli trials and differ only in what is fixed and what is counted. Fix the trials and count successes and you have the binomial; fix the successes and count failures or trials and you have the negative binomial; set r = 1 and it collapses to the geometric.

DistributionWhat is fixedWhat is countedTypical question
BinomialNumber of trials nSuccessesHow many heads in 10 flips?
Negative binomialNumber of successes rFailures (or total trials) until the r-th successHow many tails before the 3rd head?
GeometricSuccesses fixed at r = 1Failures before the first successHow many misses before the first hit?

One warning the table cannot show: this page models independent trials at a constant p, the textbook waiting-time model. A second, separate use of the name “negative binomial” fits overdispersed count data in regression, where r is estimated from data and can be fractional. That is a different job, and this calculator is honest about not doing it: it rejects a fractional r instead of pretending the count model still applies.

What competing calculators miss

Negative binomial tools online split into a few camps, and each leaves a gap this page closes:

  • One-notation tools (the long-running failures-only applet, Statistics by Jim’s calculator): a single parameterization, failures only or trials only. Students whose textbook uses the other convention get a wrong-looking answer and no hint that Y = X + r converts it. This page runs both and shows the conversion.
  • Wrong-formula pages (CalculatorUltra, MadeCalculators): one presents P = k × (1−p)/p as “the Negative Binomial”, which is a mean, not a probability, and computes 11.67 as if it were one; the other prints a PMF with the roles of k and r and the exponents swapped. A probability that comes out above 1, or built from swapped parameters, is not a rounding issue. Every formula on this page is stated next to the tool and reproduces in the checks table.
  • Docs-first tools (MetricGate): genuinely broad, with quantiles, random samples and R references, but the extras bury the basic job and the failure count is optional, so a first-time user can run it without ever evaluating a specific outcome. Here the target is a required, validated input.
  • Single-number interactives (Firgelli): a PMF value and two expectations, nicely visual, but no cumulative tails, no mode, no skewness, no table to audit the sums against. The four tails and the row-by-row table are where planning answers actually live.
  • The gap this page fills: both parameterizations with the conversion stated, all four cumulative variants, mean through excess kurtosis, a chart with your target marked, a probability table that shows its cumulative working, and validation that names the exact problem (a fractional r, an n below r, a target past 2000) instead of returning a silent wrong number.

Frequently asked questions

The failures-before-success form counts X = k failures preceding the r-th success; the total-trials form counts Y = n trials including the final success. They are linked by Y = X + r, so k = 2 failures with r = 3 successes is the same event as n = 5 total trials, and both modes return the same probability for it.

At r = 1: the failures before the first success follow the geometric distribution, P(X = k) = (1-p)^k × p. Try r = 1, p = 0.3, k = 4 in the calculator: the exact probability is 0.07203, which is 0.7^4 × 0.3.

r counts successes, and you cannot have 2.5 successes. In this counting model the binomial coefficient C(k+r-1, k) is only defined for a whole-number r, so the calculator rejects a fractional r with a message instead of silently rounding it. A generalized version with real r exists for regression work, but it answers a different question and is not what this tool computes.

Quality control (defects before the 10th good unit), sales (calls before the 5th yes), epidemiology (cases before a cluster threshold), and anywhere the question is “how long until r successes”. The mean tells you the average wait and the cumulative tails tell you the wait you can budget for.

The binomial fixes the number of trials and counts successes; the negative binomial fixes the number of successes and counts trials (or failures). One fixes n, the other fixes r. If your trial count is set in advance, use the binomial; if you keep going until a target number of successes, use this distribution.

P(X ≤ target) is the chance the wait finishes at or before your target, and it is the one to use for planning and deadlines. P(X > target) is the chance it overruns. P(X < target) and P(X ≥ target) are the strict versions of the same two questions, and all four are shown so you never have to guess whether the target itself is included.

At p = 1 every trial succeeds, so the wait is exactly 0 failures with probability 1 and the variance is 0. Skewness and excess kurtosis divide by terms that contain (1-p), which is 0, so both are undefined and the calculator prints a dash rather than a made-up number. The exact probability, mean and variance still compute normally.

Add This Calculator to Your Website

Embed this calculator on your own site with the code below. Pick a size to preview it live, then copy the code.

Powered by Calculator Zilo

References

  1. National Institute of Standards and Technology. NIST/SEMATECH e-Handbook of Statistical Methods: Negative Binomial Distribution. Accessed October 22, 2026.
  2. R Core Team. The Negative Binomial Distribution (dnbinom, pnbinom) in R. Accessed October 22, 2026.
  3. National Institute of Standards and Technology. NIST Digital Library of Mathematical Functions: Binomial Coefficients. Accessed October 22, 2026.
  4. Pennsylvania State University, Eberly College of Science. STAT 414: Geometric and Negative Binomial Distributions. Accessed October 22, 2026.
  5. Johnson, N. L., Kemp, A. W. and Kotz, S. Univariate Discrete Distributions, 3rd edition (Wiley). Accessed October 22, 2026.

Related calculators

Probability CalculatorsDiscrete Probability Distribution CalculatorA discrete random variable takes countable outcomes: the number of heads in two coin tosses, the defects in a batch, the goals in a match.Probability CalculatorsProbability Percentage CalculatorProbability tells you how likely an event is, and a percentage tells you at a glance.Probability CalculatorsPoisson Distribution Probability CalculatorA Poisson model answers one question: if events happen at a steady average rate, how likely is a particular count in the next interval?Probability CalculatorsDice Average CalculatorRoll the same dice long enough and the totals settle around one number: the expected average.Probability CalculatorsCoin Flip Probability CalculatorFlip a coin 10 times and exactly 6 heads feels like it should be common, yet it happens only about one time in five.Probability CalculatorsBinomial Coefficient CalculatorThe binomial coefficient C(n, k), read “n choose k,” counts how many ways you can pick k items from a set of n when the order of the pick does not matter.

We use cookies to analyze traffic. You can accept or decline cookies below. Learn more

calculatorzilo

CalculatorZilo

Free calculators for everyday life. No signup, no cost, just answers.

Categories

Finance Math Health & Fitness Education Science Real Estate Chemistry Browse all calculators

Popular tools

Mortgage Payment Calculator BMI Walking Calculator Salary Per Minute Calculator Percentage Off Calculator

Company

About Us Contact Us Privacy Policy Terms and Conditions
Disclaimer Cookie Policy DMCA Policy Affiliate Disclosure FAQ Accessibility Statement

© 2026 CalculatorZilo • Free calculators for everyone

  • Home
  • Calculators
    • Browse all calculators
    • Education
    • Real Estate
    • Chemistry
  • Finance
  • Math
  • Health & Fitness
  • Science
  • About
  • Contact
Search