The Birthday Paradox: Why 23 People Is Enough
Put 23 people in a room and the odds are slightly better than even that two of them share a birthday. Most people guess a number closer to 180, and the gap between that guess and the real answer says a lot about how intuition handles probability.
Last updated:
What the birthday paradox says
The birthday paradox, or birthday problem, asks how many people you need before there is at least a 50% chance that some two of them share a birthday. The answer is 23. It is not a true paradox, since nothing about it is contradictory; it earns the name because the result surprises nearly everyone who hears it.
The standard calculation assumes a 365-day year, ignores February 29, and treats every birthday as equally likely. Real births are not perfectly uniform; they vary by season and are often lower on weekends and holidays. Uneven distributions make matches more likely, not less, so the textbook numbers are, if anything, slightly conservative.
Calculating it with the complement
Counting every way a match can happen directly is messy: one pair, two pairs, three people on one date, and so on. It is much easier to compute the probability that everyone has a different birthday and subtract it from 1.
The first person can have any birthday. The second person avoids the first person's date with probability 364/365. The third avoids both earlier dates with probability 363/365, and the nth person avoids all earlier dates with probability (365 − n + 1)/365. Multiply these together to get the chance that all n birthdays are distinct. The chance of at least one match is 1 minus that product.
It helps to try a small case. For 5 people, the all-different probability is 365 × 364 × 363 × 362 × 361 ÷ 365^5 ≈ 0.9729, so the chance of a match is about 2.71%. Each extra person adds another fraction to the product, and each new fraction is a little smaller than the last, so the all-different probability falls faster and faster as the group grows.
With 23 people the all-different probability is about 49.27%, so the chance of a shared birthday is about 50.73%. With 22 people it is about 47.57%, which is why 23 is the smallest group that crosses the 50% line. The probability climbs fast after that.
In a class of 40, the chance of a shared birthday is about 89%, so roughly nine classrooms out of ten will have one. At 57 people it passes 99%, and at 100 people it is about 99.99997%. Only at 366 people (367 if you count February 29) does it reach a true 100%, by the pigeonhole principle; before that, a match is merely very likely.
- 10 people: about 11.69%
- 20 people: about 41.14%
- 23 people: about 50.73%
- 30 people: about 70.63%
- 40 people: about 89.12%
- 50 people: about 97.04%
- 57 people: about 99.01%
- 70 people: about 99.92%
Why intuition gets it wrong
The usual mistake is to answer a different question: does anyone share my birthday? With 22 other people in the room, the chance that at least one matches you is 1 − (364/365)^22, only about 5.9%. To have a 50% chance that someone matches you specifically, you would need 253 other people.
The actual question allows any pair to match. In a group of 23 there are 23C2 = 253 different pairs, and every one of them is a chance for a coincidence. The number of pairs grows roughly with the square of the group size, so doubling the group roughly quadruples the opportunities: going from 23 to 46 people raises the pair count from 253 to 1,035. Our intuition tends to scale linearly, which is why it lags so far behind.
This leads to a handy approximation: the match probability is about 1 − e^(−n(n − 1) ÷ (2 × 365)). Plugging in 23 gives about 50.0%, very close to the exact figure. Solving for 50% gives n ≈ √(2 × ln 2 × 365) ≈ 22.5. More generally, with N equally likely values, a repeat becomes a coin flip after roughly 1.18 × √N draws.
Trying it with dice
Dice make the same effect easy to test at a kitchen table, because a die has only six faces. Roll a six-sided die four times. The number of ways to get four different faces is 6P4 = 6 × 5 × 4 × 3 = 360, out of 6^4 = 1,296 equally likely sequences. So the chance that all four rolls differ is 360 ÷ 1,296 ≈ 27.8%, and the chance of at least one repeated face is about 72.2%. With three rolls the all-different chance is 6 × 5 × 4 ÷ 216 ≈ 55.6%, so a repeat is only 44.4% likely. Four rolls is therefore the dice version of 23 people: the first point where a repeat becomes more likely than not.
Roll six times and the chance that every face is different drops to 6! ÷ 6^6 = 720 ÷ 46,656 ≈ 1.54%. A repeat is all but certain, about 98.5%, even though six rolls could in principle cover all six faces exactly once. The dice probability calculator shows a related idea from another angle: with two dice, the total 7 is the most common sum (6 of 36 outcomes) simply because more combinations produce it.
Hash collisions and other real uses
The birthday problem matters well beyond parties. A hash function maps data to a fixed-size value, and a collision occurs when two different inputs produce the same value. If there are N possible hash values, a collision becomes about 50% likely after roughly 1.18 × √N inputs. Even a 64-bit hash, with about 1.8 × 10^19 possible values, reaches even odds of a collision at around 5.1 billion items.
In cryptography this is known as the birthday attack, and it is the reason secure hash functions use long outputs: the effective protection against collisions is only about half the number of bits. The same arithmetic helps estimate how likely randomly generated IDs, coupon codes or ticket numbers are to repeat.
The birthday paradox calculator takes the number of people and returns the probability of a shared birthday, the probability that all birthdays differ, the smallest group size that passes 50%, and a probability curve. You can also change the number of days. Setting it to 366 still gives 23 people, and setting it to 1,000,000 shows that issuing just 1,178 random codes from a million gives better-than-even odds of a duplicate.