# Binomial Distribution Calculator

> Computes the probability of exactly, at most, at least, fewer than or more than k successes in n independent trials with success probability p, plus the mean, variance and standard deviation of the distribution.

- Calculator id: `binomial-distribution` · Category: Statistics & Probability (`statistics`) · Tool name: `calculate_binomial_probability`
- Canonical page: https://tttkmbb.com/statistics/binomial-distribution · This document: https://tttkmbb.com/statistics/binomial-distribution.md · JSON definition: https://tttkmbb.com/statistics/binomial-distribution.json

## Purpose

Computes the probability of exactly, at most, at least, fewer than or more than k successes in n independent trials with success probability p, plus the mean, variance and standard deviation of the distribution.

**Use when:** You have a fixed number of independent yes/no trials with a constant success probability (coin flips, defect counts in a batch, conversions among n visitors) and need the probability of a number of successes.

**Do not use when:** Trials are not independent or p changes, the number of trials is not fixed, or you count events over time or space at an average rate (use poisson-distribution).

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `trials` | integer |  | required | Total number of independent trials. (min 1, max 100000) |
| `successes` | integer |  | required | Number of successes of interest (0 ≤ k ≤ n). (min 0, max 100000) |
| `probability_of_success` | number |  | required | Probability of success on a single trial, as a number between 0 and 1 (0.5 for 50 %), not a percentage. (min 0, max 1) |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `probability_exact` | number |  | Probability of exactly k successes. |
| `probability_at_most` | number |  | Cumulative probability of k or fewer successes. |
| `probability_at_least` | number |  | Probability of k or more successes. |
| `probability_less_than` | number |  | Probability of fewer than k successes. |
| `probability_more_than` | number |  | Probability of more than k successes. |
| `mean` | number |  | Expected number of successes n·p. |
| `variance` | number |  | n·p·(1 − p). |
| `std_dev` | number |  | √(n·p·(1 − p)). |

## Formula

`P(X = k) = C(n, k) · p^k · (1 − p)^(n − k); P(X ≤ k) = Σ_{i=0..k} P(X = i); P(X ≥ k) = Σ_{i=k..n} P(X = i); mean = n·p; variance = n·p·(1 − p)`

Probabilities are computed term by term in log space, so large n does not overflow the binomial coefficient. Results are exact (no normal approximation).

## Data Sources

- NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.6.6.18 Binomial Distribution — https://www.itl.nist.gov/div898/handbook/eda/section3/eda366i.htm (government, retrieved 2026-09-23)
- Wikipedia – Binomial distribution — https://en.wikipedia.org/wiki/Binomial_distribution (reference, retrieved 2026-09-23)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/binomial-distribution?trials=…&successes=…&probability_of_success=…`
- `POST https://tttkmbb.com/api/v1/calculate/binomial-distribution` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/binomial-distribution · OpenAPI operationId `calculate_binomial_probability` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "binomial-distribution", "inputs": {…}}`

## Example

- 3 heads in 10 fair coin flips: inputs `{"trials":10,"successes":3,"probability_of_success":0.5}` → `{"probability_exact":0.117188,"probability_at_most":0.171875,"probability_at_least":0.945313,"probability_less_than":0.054688,"probability_more_than":0.828125,"mean":5,"variance":2.5,"std_dev":1.5811}`
- 2 defects in 20 items at 10 %: inputs `{"trials":20,"successes":2,"probability_of_success":0.1}` → `{"probability_exact":0.28518,"probability_at_most":0.676927,"probability_at_least":0.608253,"mean":2,"variance":1.8,"std_dev":1.3416}`

```
GET https://tttkmbb.com/api/v1/calculate/binomial-distribution?trials=10&successes=3&probability_of_success=0.5
```

## Limitations

Trials are not independent or p changes, the number of trials is not fixed, or you count events over time or space at an average rate (use poisson-distribution). Probabilities are computed term by term in log space, so large n does not overflow the binomial coefficient. Results are exact (no normal approximation). All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**Is p a percentage?**

No. Enter the single-trial success probability as a fraction between 0 and 1: 0.25 for 25 %.

**When can the normal approximation be used instead?**

When n·p ≥ 10 and n·(1 − p) ≥ 10 the binomial is close to a normal with mean n·p and SD √(n·p·(1 − p)); this calculator does not need the approximation because it computes the exact sum.

## Related

- [Poisson Distribution Calculator](https://tttkmbb.com/statistics/poisson-distribution.md) — Counts of rare events at an average rate (limit of the binomial for large n, small p).
- [Probability of Two Events Calculator](https://tttkmbb.com/statistics/probability-of-events.md) — Combine the probabilities of two events.
- [Combinations and Permutations Calculator](https://tttkmbb.com/math/combinations-permutations.md) — The binomial coefficient C(n, k) used in the formula.
