The surprising answer
How many people must be in a room for there to be a better-than-even chance that two of them share a birthday? Most people guess around 180. The answer is 23.
Why it works
The question is not whether someone shares your birthday, but whether any two people share one. With 23 people there are 23 × 22 ÷ 2 = 253 pairs, and each pair is a chance for a match.
The formula
It is easier to compute the probability that all birthdays are different:
P(all different) = 365 × 364 × … × (365 − n + 1) ÷ 365ⁿ
and then P(at least one shared) = 1 − P(all different).
Worked example
For 23 people:
- P(all different) = 365 × 364 × … × 343 ÷ 365²³ ≈ 49.27%.
- P(shared) = 1 − 49.27% ≈ 50.73%.
- Chance that someone shares your birthday: 1 − (364 ÷ 365)²² ≈ 5.86%.
Probabilities by group size
| People | Chance of a shared birthday |
|---|---|
| 10 | 11.7% |
| 20 | 41.1% |
| 23 | 50.7% |
| 30 | 70.6% |
| 40 | 89.1% |
| 50 | 97.0% |
| 70 | 99.9% |
Beyond birthdays
The same math applies whenever items are assigned at random to a limited number of slots. The calculator lets you change the number of days to any number of categories.
- Computer security: a “birthday attack” finds two inputs with the same hash much faster than expected. A hash with 2ⁿ possible values needs only about 2^(n/2) tries, which is why hash functions use at least 256 bits.
- Lotteries: repeated winning numbers across many draws are far more common than intuition suggests.
- Data: random identifiers collide sooner than expected if they are too short.
A handy approximation: a 50% chance of a collision needs about √(2 × d × ln 2) ≈ 1.18 × √d items, where d is the number of possible values.
Assumptions
The calculation assumes 365 equally likely birthdays and ignores February 29 and twins. Real births are slightly uneven across the year, which makes shared birthdays a little more likely than the formula says.