How do you calculate the birthday paradox?
The birthday paradox asks: how many people do you need in a room before it is more likely than not that two of them share a birthday? Most people guess somewhere around 180, half of 365. The real answer is 23.
The trick is to work out the opposite first: the chance that everyone has a different birthday. The first person can have any birthday. The second must avoid one day (364 out of 365), the third must avoid two (363 out of 365), and so on. Multiply those fractions together and subtract from 1.
P(shared birthday) = 1 − (365 × 364 × … × (365 − n + 1)) ÷ 365n
The calculation assumes 365 equally likely birthdays and ignores February 29. Real births are slightly uneven across the year, which actually makes a match a little more likely, not less.
Why so few people?
Our intuition quietly compares everyone with ourselves. But the paradox is about any two people matching, and the number of possible pairs grows much faster than the group. With 23 people there are 23 × 22 ÷ 2 = 253 pairs, and each pair is a fresh 1-in-365 chance.
| People | Pairs | Chance of a shared birthday |
|---|---|---|
| 10 | 45 | 11.7% |
| 20 | 190 | 41.1% |
| 23 | 253 | 50.7% |
| 30 | 435 | 70.6% |
| 40 | 780 | 89.1% |
| 50 | 1,225 | 97.0% |
| 57 | 1,596 | 99.0% |
| 70 | 2,415 | 99.9% |
What about someone sharing your birthday?
That is a much harder target. With n people in the room including you, the chance that at least one of the others matches your birthday is 1 − (364/365)n−1. In a group of 23 it is only 5.9%. To push it past 50% you need 253 other people, which is exactly the number of pairs in a group of 23. That neat coincidence is a good way to remember why the two questions are so different.
A rule of thumb
For a 50% chance of a match among d equally likely options, you need roughly 1.18 × √d items. For 365 days, 1.18 × √365 ≈ 22.5, which rounds to 23. The same rule explains why "hash collisions" in computer science turn up far sooner than people expect, a problem known as the birthday attack.
Why doesn't the simulation match the theory exactly?
A simulation is a set of random trials, so the share of groups with a match wanders around the true value. With 100 groups of 23, getting anywhere from about 40 to 60 matches is perfectly normal. Run more groups and the observed percentage settles closer to 50.7%. The simulation uses your browser's cryptographic random number generator, so every day of the year is equally likely.
Where does this show up in real life?
Beyond classrooms and office parties, the same math underlies cryptography, checks for duplicate records in databases and the odds of two lottery draws repeating a number combination. If you enjoy counterintuitive probability, try the Monty Hall problem, see what your real chances are in the lottery odds calculator, or count possible groups with the combination calculator.
Frequently asked questions
What is the birthday paradox?
What are the odds of two people sharing a birthday in a group of 23?
How many people do you need for a guaranteed shared birthday?
What are the odds someone shares my birthday?
What is the chance of a shared birthday in a class of 30?
Sources: Probabilities on this page are calculated with the standard product formula, assuming 365 equally likely birthdays and excluding February 29. The simulation uses the browser's cryptographic random number generator (crypto.getRandomValues).
Last updated: December 1, 2026
Results are for information only. For official or financial decisions, consult a qualified professional.