Binomial Distribution Calculator
Is this tool helpful?
How to use the tool
- Fill n — trials: type 12 or 45 (whole numbers only).
- Fill p — success probability: enter 0.40 or 0.18 (range 0–1).
- Fill k — successes: choose any integer 0 ≤ k ≤ n, e.g., 3 or 20.
- Press “Calculate”: the result shows P(X = k).
- Reset fields: hit “Clear” before a new scenario.
Formulas the script applies
Exact probability mass function:
$$P(X=k)=rac{n!}{k!\,(n-k)!}\,p^{k}(1-p)^{n-k}$$
Mean: $$\mu = n p$$ Variance: $$\sigma^{2}=n p(1-p)$$
Worked examples
- Example 1: n = 12, p = 0.40, k = 3 220 × 0.4³ × 0.6⁹ = 0.1411.
- Example 2: n = 5, p = 0.70, k = 4 5 × 0.7⁴ × 0.3 = 0.3602.
Quick-Facts
- Discrete two-outcome model; trials assumed independent (NIST/SEMATECH e-Handbook, 2023).
- Mean = np, Variance = np(1−p) (Ross, 2014).
- Normal approximation reasonable when n p ≥ 5 and n(1−p) ≥ 5 (Walpole et al., 2017).
- Exact JavaScript factorial safe up to n≈170 before overflow (MDN Web Docs, 2023).
FAQ
What is the binomial distribution?
The binomial distribution counts the number of successes in n identical, independent Bernoulli trials with constant probability p (Ross, 2014).
When should I use this calculator?
Use it whenever you need an exact P(X = k) for binary outcomes, such as pass/fail tests or defect counts (NIST, 2023).
Why must n and k be integers?
Trials and successes are count data; fractional counts violate the underlying Bernoulli model (Walpole et al., 2017).
Can the tool show cumulative probability?
You can sum successive exact outputs; cumulative mode is planned but not yet implemented.
How large can n be?
Exact factorial math stays stable up to about 170; beyond that, numerical libraries or logarithms are advised (MDN, 2023).
What happens if p = 0 or 1?
Probability collapses: P(X = 0) = 1 when p = 0; P(X = n) = 1 when p = 1, all else zero.
Is a normal approximation acceptable?
Yes, if n p and n(1−p) are both at least 5; accuracy improves as these products grow (Walpole et al., 2017).
Expert tip
“The binomial model is exact; use it whenever computationally feasible,” advises the NIST e-Handbook (2023).
Important Disclaimer
The calculations, results, and content provided by our tools are not guaranteed to be accurate, complete, or reliable. Users are responsible for verifying and interpreting the results. Our content and tools may contain errors, biases, or inconsistencies. We reserve the right to save inputs and outputs from our tools for the purposes of error debugging, bias identification, and performance improvement. External companies providing AI models used in our tools may also save and process data in accordance with their own policies. By using our tools, you consent to this data collection and processing. We reserve the right to limit the usage of our tools based on current usability factors. By using our tools, you acknowledge that you have read, understood, and agreed to this disclaimer. You accept the inherent risks and limitations associated with the use of our tools and services.
