The Birthday Paradox: Why 23 People Means a 50% Shared Birthday
Why 23 people give a 50% chance of two sharing a birthday — the counterintuitive math behind the birthday paradox, with worked examples and hash collisions.
The Birthday Paradox: Why 23 People Means a 50% Shared Birthday
Ask a room of 23 people how many of them you'd need before two share a birthday with even odds, and almost everyone guesses something close to 180 — half of 365, give or take. The real answer is 23. That gap between gut feeling and arithmetic is the birthday paradox, and once you see why it happens, you stop being able to un-see it. It shows up again in cryptography, in hash tables, and anywhere two random things might accidentally land on the same value.
The question you think you're asking isn't the one that matters
Here's the trap. Most people silently rephrase the problem as: "How many people do I need before someone shares my birthday?" That version really does grow slowly. Each new person has a 1-in-365 shot at matching your specific date, so you need roughly 253 people to cross 50% odds. That number feels right, and it's the number your intuition reports.
But the birthday paradox asks a different question: "How many people do I need before any two of them share a birthday?" Now every person can collide with every other person, not just with you. With 23 people there are 23 × 22 / 2 = 253 distinct pairs — and notice that 253 again. Same count, completely different question. The 50% threshold lands in the same place because the number of chances is the same; it's just that you were imagining the chances pointed only at you.
The math: count the misses, not the hits
Counting "at least one shared birthday" directly is messy, because "at least one" could mean one pair, or two pairs, or three people all on the same day. The clean trick is to count the opposite — the probability that everyone is unique — and subtract from 1.
Line people up and assign birthdays one at a time. The first person can be born any day. The second has to dodge that one day, so 364/365. The third dodges two days, 363/365. Keep going, and the probability that all N people miss each other is:
P(no match) = 365/365 × 364/365 × 363/365 × ... × (365 − N + 1)/365
The probability that at least two collide is just the complement:
P(at least one shared birthday) = 1 − P(no match)
That's the whole thing. The birthday paradox calculator computes this in log space so it stays numerically stable all the way up to N = 365, and it draws the full curve from 1 to 100 people so you can watch the climb instead of just reading a number.
A worked example, person by person
Let's run N = 23 by hand for the first few steps so the formula stops being abstract:
- Person 2 avoids person 1: 364/365 ≈ 0.99726
- Person 3 avoids both: 363/365 ≈ 0.99452
- Person 4 avoids all three: 362/365 ≈ 0.99178
- ...keep multiplying down to (343/365) for the 23rd person.
Multiply all 22 fractions together and you get P(no match) ≈ 0.4927. So the chance that at least two of the 23 share a birthday is 1 − 0.4927 ≈ 0.507, or 50.7%. A hair over a coin flip, at just 23 people.
The curve keeps accelerating after that. By 30 people you're at 70.6%, by 50 people you're at 97.0%, and by 70 people you've reached 99.9% — practically guaranteed. To get to a 99.9% chance of someone matching your specific birthday, you'd need thousands of people. The two questions diverge fast.
Why the curve shoots up so steeply
The reason the probability piles up faster than intuition expects is that the number of pairs grows quadratically, as N(N−1)/2. Double the group from 10 to 20 people and the pairs don't double — they quadruple, from 45 to 190. Every new arrival opens a fresh collision chance against every person already in the room, not just one. So "at least one collision somewhere" compounds much faster than the linear "one more person" feeling suggests. If you want to sanity-check any of these ratios, a quick percentage calculator will turn the raw probabilities into the percentages you'd actually quote.
I first ran into this teaching a small seminar. I asked twenty-some students to write their birthdays on the board, fully expecting to be wrong about half the time and have to laugh it off. Two of them had matched before I'd finished writing the list. I'd seen the formula a dozen times, but watching it land in under a minute, on actual people in the room, did something the algebra never had. That's the demo I keep coming back to: the math is one line, but the surprise is visceral.
The same paradox runs cryptography
This isn't a party trick — the exact same math sets security parameters for cryptographic hash functions. A hash maps any input to a fixed-size output, and a "collision" is two different inputs producing the same hash. The number of possible outputs is your "year." For a hash with D possible outputs, the 50% collision threshold sits at roughly 1.177·√D — the square-root scaling that the birthday curve obeys for any year length.
That square root is brutal for security. A 64-bit hash has 2^64 ≈ 18 quintillion possible outputs, which sounds unbreakable. But collisions become likely at around √(2^64) = 2^32 ≈ 4.3 billion samples — a number a laptop can churn through. This is why a 64-bit digest gives you only about 32 bits of collision resistance, why MD5 collisions are trivially found today, and why modern systems use 256-bit hashes (SHA-256) to push the birthday bound out to 2^128. The same logic governs hash table sizing: with N keys dropped into M slots, collision odds cross 50% at N ≈ 1.177·√M, which is exactly why you size hash tables generously rather than to capacity.
Try it on your own numbers
The paradox is most convincing when you plug in a group you actually know. Got a 28-person team? Enter 28 and you'll read 65.4% — meaning a shared birthday on your team is more likely than not, and the "everyone unique" case (34.6%) is the rarer outcome. Once a group passes 23, expecting an overlap is the correct default, not the surprising one.
Open the birthday paradox calculator, drag N around, and watch the curve cross the 50% line at 23. Then mentally swap "365 days" for "number of hash outputs" and you'll understand both a classroom probability demo and a cryptographic attack in the same breath. Same math, same paradox, two very different rooms.
Made by Toolora · Updated 2026-06-13