Math Tools Math Tools

The Birthday Paradox: Why 23 People Are Enough

The Birthday Paradox: Why 23 People Are Enough

By Math Tools ·

The Birthday Paradox: Why 23 People Are Enough

How many people do you need in a room before there's a 50% chance that two of them share a birthday? Most people guess somewhere around 180, about half of 365.

The real answer is 23. With 70 people, the probability climbs to 99.9%. And during the 2014 FIFA World Cup, when every squad had exactly 23 players, a BBC analysis found that 16 of the 32 teams, exactly half, had at least one pair of players sharing a birthday.


It's Not About Your Birthday

The mistake is imagining the question as "does someone share my birthday?" That really does need a big group. For a better-than-even chance that someone matches you, you need 253 other people.

But the birthday paradox asks whether any two people match. And the number of possible pairs grows much faster than the number of people:

Pairs among n people = n(n − 1) / 2
Pairs among 23 people = 23 × 22 / 2 = 253

With 23 people there are already 253 different pairs, each a chance for a match. Not coincidentally, that's the same 253 as above.


The Calculation

It's easier to calculate the chance that nobody shares a birthday, then subtract from 1. We'll assume 365 equally likely birthdays and ignore leap days.

  • Person 1 can have any birthday: 365/365
  • Person 2 must avoid person 1's: 364/365
  • Person 3 must avoid both: 363/365
  • Person 23 must avoid 22 birthdays: 343/365

Multiply them together:

P(no match) = (365 × 364 × 363 × … × 343) / 365²³ ≈ 0.4927
P(match)    = 1 − 0.4927 ≈ 0.5073

So in a group of 23, there's about a 50.7% chance that at least two people share a birthday.


How Fast the Probability Grows

People Chance of a shared birthday
10 11.7%
20 41.1%
23 50.7%
30 70.6%
40 89.1%
50 97.0%
57 99.0%
70 99.9%

You only reach a guaranteed match at 366 people (by the pigeonhole principle: 366 people, 365 possible birthdays). But you're at 99% by 57. You can test this with a simulation using the random number generator: generate 23 numbers from 1 to 365 and check for repeats.


A Quick Approximation

For a group of n people and d possible "birthdays," the chance of a match is approximately:

P ≈ 1 − e^(−n² / (2d))

Set P = 0.5 and solve:

n ≈ √(2d × ln 2) ≈ 1.18 × √d

For d = 365: 1.18 × √365 ≈ 1.18 × 19.1 ≈ 22.5. The key insight is that the group size needed grows with the square root of the number of possibilities, not in proportion to it. Try the square root with the square roots list and the natural log with the logarithm calculator.


An Insider Reference: Von Mises and Birthday Attacks

The birthday problem is usually credited to the Austrian mathematician Richard von Mises, who discussed it in 1939. It has since become one of the most important ideas in computer security.

A hash function turns data into a fixed-length fingerprint. If two different inputs produce the same fingerprint, that's a collision, and attackers can exploit it. The birthday paradox says that for a hash with 2ⁿ possible outputs, you only need to try about 2^(n/2) inputs before a collision becomes likely.

That's why a 128-bit hash offers only about 64 bits of collision resistance. In 2017, researchers from Google and CWI Amsterdam announced SHAttered, the first practical collision for the SHA-1 hash function, producing two different PDF files with the same SHA-1 fingerprint. The same square-root math is why modern systems use 256-bit hashes like SHA-256.


Real Birthdays Make It Even More Likely

The calculation assumes every birthday is equally likely. Real birthdays aren't. In many countries, births cluster in certain months, and fewer babies are born on major holidays because of scheduled deliveries.

Mathematically, any unevenness increases the chance of a match. The uniform distribution is the hardest case, so 23 is actually a slight overestimate for real people.


Two Concepts Worth Knowing

Complementary Probability

When "at least one" is hard to calculate, compute the probability of none and subtract from 1: P(at least one) = 1 − P(none). It's one of the most useful shortcuts in probability.

Combinations

The number of ways to pick 2 people from n is the combination C(n, 2) = n(n − 1)/2. Counting pairs, not people, is what reveals the paradox.


Quick Answer: Why Do 23 People Give a 50% Birthday Match?

With 23 people there are 253 possible pairs, and each pair is a chance for a shared birthday. The probability that all 23 birthdays are different is (365 × 364 × … × 343) / 365²³ ≈ 49.3%, so the chance of at least one match is about 50.7%.


Try Them Yourself

Next time you're in a group of 30 or more, ask everyone's birthday. There's a 70% chance you'll find a match, and a great chance to explain why.