Ask most people how many others you'd need in a room before there's a better-than-even chance two of them share a birthday, and the guesses tend to cluster somewhere around 180 β half of 365, following an intuition that seems reasonable on its face. The real answer is 23. The gap between the intuitive guess and the true answer is exactly what makes the birthday problem one of the most famous, most reliably surprising results in all of probability β and it's a clean, fully worked demonstration of the complement rule and multiplication rule in action.
- Why the complement β calculating "no shared birthday" first β is the key trick
- The full worked calculation, step by step, for 23 people
- Why the answer feels so wrong to most people's intuition
- How the probability changes with group size
Why the Complement Rule Is the Key
Calculating "the probability that at least two people share a birthday" directly is awkward β there are many different ways a shared birthday could happen (exactly one pair, two separate pairs, three people all sharing one date, and so on), and adding up every one of those scenarios individually is genuinely messy. The clean way in is through the complement: calculate the probability that no one shares a birthday (every single person has a distinct birthday from everyone else), and then subtract from 1.
This is the same complement-rule logic covered in basic probability, applied to a problem where it isn't just convenient but genuinely necessary to make the calculation tractable at all.
Calculating "No Shared Birthdays"
Assume 365 equally likely birthdays (ignoring leap years for simplicity) and that everyone's birthday is independent of everyone else's. Line the people up one at a time: the first person can have any birthday at all β probability 365/365 = 1. The second person, to avoid matching the first, must land on one of the 364 remaining days: probability 364/365. The third person must avoid both of the first two people's birthdays: probability 363/365. This pattern continues, with the available "safe" days shrinking by one for each additional person, and β using the multiplication rule for independent events, exactly as in a probability tree β all these fractions multiply together:
Worked Example: 23 People
For n = 23, multiply 23 fractions together: (365/365) Γ (364/365) Γ (363/365) Γ ... Γ (343/365). Carrying out this calculation (most easily done with software, though it's fully mechanical by hand with enough patience) gives:
P(no shared birthday, n=23) β 0.4927
P(at least one shared birthday, n=23) = 1 β 0.4927 β 0.5073
With just 23 people, there's just over a 50% chance at least two of them share a birthday β genuinely better than a coin flip, despite there being 365 possible birthdays and only 23 people in the room. It's worth sitting with how counterintuitive that really is before moving on to why it happens.
Why Intuition Gets This So Wrong
The instinct that pulls people toward a much larger number (something near 180) comes from thinking about the problem the wrong way around β asking "how likely is it that someone shares my specific birthday?" rather than the actual question, "how likely is it that any two of the people in the room share any birthday?" The first question really does need a much larger group before becoming likely, since it's pinned to one specific date. But the second question has far more opportunities to succeed: with 23 people, there are C(23,2) = 253 distinct pairs of people, and a shared birthday only needs to happen for just one of those 253 pairs, not for a match against one predetermined date. Two hundred fifty-three chances for a match, each with modest but nonzero odds, adds up to a genuinely high combined probability far faster than intuition expects β the same kind of "many chances for a rare event to occur somewhere" reasoning that shows up in the law of large numbers and related probability results.
How the Probability Changes With Group Size
| Group size | P(at least one shared birthday) |
|---|---|
| 10 | 11.7% |
| 20 | 41.1% |
| 23 | 50.7% |
| 30 | 70.6% |
| 50 | 97.0% |
| 70 | 99.9% |
The probability rises far faster than a linear guess would suggest β by 50 people, a shared birthday is all but guaranteed, and by 70 people it's essentially certain. This steep, non-linear rise is exactly why the intuitive "half of 365" guess misses so badly: the true relationship isn't remotely close to linear in group size.
Real-World Relevance Beyond the Party Trick
The same underlying mathematics β how quickly the probability of at least one "collision" rises as the number of items grows, far faster than intuition expects β shows up well beyond birthdays. In computer science, this exact structure underlies the birthday attack in cryptography, where finding two inputs that hash to the same output value becomes surprisingly likely far sooner than the size of the hash space alone would suggest, directly informing how large a hash function's output needs to be to remain secure. Any situation involving randomly assigning items into a fixed number of "slots" (dates, hash values, randomly generated IDs) and asking about the chance of any collision follows the same logic demonstrated here.
The same reasoning also matters for database and system design: randomly generated identifiers (order numbers, session tokens, short URL codes) that look astronomically unlikely to collide when compared one-at-a-time can still accumulate a meaningful collision risk once enough of them have been generated, for exactly the same "many pairs, not one fixed target" reason the birthday problem itself reveals. Engineers sizing an ID space large enough to keep collision probability acceptably low are, whether they realize it or not, applying the same complement-rule calculation worked through above.
Common Mistakes
Confusing "at least one shared birthday" with "someone shares my birthday." These are genuinely different questions, as the intuition-versus-reality discussion above explains β the second, much rarer question needs a group of 253 people to cross 50% probability, dramatically more than the 23 needed for the actual birthday problem.
Trying to calculate the probability of a match directly instead of via the complement. Directly summing every possible way a shared birthday could occur (exactly one pair, two pairs, a triple, and so on) is far more error-prone and tedious than the clean complement-rule approach used above.
Does the birthday problem assume all 365 days are equally likely?
How many people are needed for a 99% chance of a shared birthday?
What if the question asks about a specific pair, like two people both born in January?
Is 23 a coincidence, or does it follow from a general formula?
Share this article
Written by
Statistics Fundamentals Editorial Team
Written and reviewed by our team of statistics educators. Content is aligned with GCSE, A-Level, AP Statistics, and undergraduate curricula.
About Statistics Fundamentals β