Birthday paradox (collision probability) calculator

Exact birthday paradox collision probability, target→n, and Monte Carlo simulation (fixed seed) — runs locally in your browser.

Compute the probability of at least one collision when drawing n samples from d equally likely values (days or 2^b hash space).

Runs locally in your browser (no server upload). Shareable URLs reproduce the same state.

Other languages 日本語 | English | 简体中文 | 繁體中文 | Español | Português (Brasil) | Bahasa Indonesia | Français | हिन्दी | العربية

How to use (3 steps)

  1. Select Days (d=365/366) or Bits (d=2^b).
  2. Enter n (or switch to “Target → n”).
  3. Copy a shareable URL or run a simulation.

Inputs

Mode
What to compute
Example:
Presets:

Results

P(collision)
P(no collision)
Approx (Poisson)
Approx error (abs / rel)
/
Target → required n
Required n (exact)
Required n (approx)

Graph

P(collision) vs n (blue). Orange line marks your current n.

Tip: hover (or tap) the graph to see the probability at a specific n. The quick table below provides accessible values.

Quick table

nP(collision)p (0..1)
Simulation (Monte Carlo)

Estimated P(collision)
95% CI (Wilson)
|p̂ − p_exact|

Notes & formulas

Examples

Classic: d=365, n=23

P(collision) is about 0.5073 (≈ 50.7%).

Hash collisions: 32-bit

Use bits mode with b=32 (d=2^32). Target 0.5 gives n≈77,164.

How to use the collision outputs

Start with the exact collision probability for your current group size, then compare it with the approximation and simulation panels to see how quickly collisions become likely.

When exact vs approximate matters

For classroom-size examples, the exact value is the reference. The approximation is useful when you want a quick sense of scale for large domains such as hashes or ID generators.

How to read the simulation panel

Use the simulation only as a sense check. If the empirical result drifts far from the exact value, increase the trial count or keep the seed fixed so you can reproduce the run.

Worked example

With d = 365 and n = 23, the exact collision probability is about 50.7%. This is the standard birthday example and a good baseline for explaining why pair counts grow quickly.

See also

FAQ

What is the birthday paradox?

It is the collision probability when drawing n samples from d equally likely values. With d=365, n=23 already gives about 50%.

Why does it exceed 50% with only 23 people?

The number of possible pairs grows as C(n,2), so collisions become likely quickly.

What is the exact formula?

P(no collision) = (d)_n / d^n, and P(collision) = 1 − P(no collision).

How do you compute the required n for a target probability?

We search the smallest integer n such that P(collision) ≥ target.

How does this relate to hash collisions (32-bit / 64-bit)?

Use bits mode (d=2^b). For 32-bit, the 50% point is about n≈77,164.

What is the seed in the simulation?

A seed makes the simulation deterministic and reproducible.

Are real birthdays uniform?

Not perfectly. This tool uses the standard uniform model.