The birthday paradox is one of probability theory’s most famous surprises: you need far fewer people than you would intuitively guess for a shared birthday to become more likely than not. This calculator computes the exact probability using the standard combinatorial formula, shows the full probability curve from n = 1 to n = 100, and includes a milestone table so you can instantly see the minimum group size required to hit any target probability.
How it works
Suppose there are d equally likely birthdays (d = 365 for a standard year). The probability that the first person has a unique birthday is d/d = 1. The second person must avoid the first person’s birthday, so their probability of being unique is (d−1)/d. The third person must avoid two occupied days, giving (d−2)/d, and so on. Multiplying these together gives the probability that all n people have distinct birthdays:
P(all distinct) = d/d × (d−1)/d × (d−2)/d × … × (d−n+1)/d
The probability of at least one shared birthday is simply the complement:
P(shared) = 1 − P(all distinct)
For large groups this product would underflow to zero in floating-point arithmetic, so the calculator sums logarithms instead of multiplying fractions, then exponentiates once at the end — preserving full double-precision accuracy for any group size up to d + 1.
Worked example
Consider a standard year with d = 365 days and a group of n = 23 people:
| n | P(all distinct) | P(shared birthday) |
|---|---|---|
| 10 | 88.31% | 11.69% |
| 20 | 58.86% | 41.14% |
| 23 | 49.27% | 50.73% |
| 30 | 29.37% | 70.63% |
| 40 | 10.87% | 89.13% |
| 57 | less than 1% | more than 99% |
At just 23 people the probability crosses 50% — a result that surprises nearly everyone when they first encounter it. By 57 people the probability is above 99%, and by 70 people it is effectively certain (99.9%).
Why the intuition fails
Most people anchor on the idea that one specific person needs someone else to share their birthday. But the question is whether any pair shares a birthday, and the number of pairs grows as n(n−1)/2. With 23 people there are 253 pairs. Each pair has a 1/365 ≈ 0.27% chance of matching, and 253 × 0.27% ≈ 69% expected matches — more than enough to push the probability over 50%. The quadratic growth of pairs is what makes the threshold so much lower than linear intuition suggests.
Beyond birthdays
The same formula underpins the birthday attack in cryptography: finding two inputs that hash to the same value. For a k-bit hash function the “collision space” has d = 2^k entries; a collision becomes probable after roughly √(2^k) × √(ln 2) ≈ 1.18 × 2^(k/2) attempts. This is why a 64-bit hash is considered insecure (collision after ~4 billion tries) while 256-bit hashes remain safe even for nation-state attackers.
Enter any pool size in the “Days in a year” field to run the same analysis for hash collisions, random identifier uniqueness, coupon-collector problems, or any other combinatorial collision scenario.
Formula note
All calculations run entirely in your browser using JavaScript’s 64-bit IEEE 754 doubles.
Log-space computation (summing Math.log(d − k) − Math.log(d) for k = 0 … n−1, then
exponentiating once) gives results accurate to approximately 15 significant figures for
any group size up to d + 1. No data is ever sent to a server.