← All posts
November 21, 2026 · 2 min read

The birthday paradox: why 23 people are enough

The birthday paradox: in a room of 23 people a shared birthday is more likely than not. Count the 253 pairs and play it out person by person.

The birthday paradox asks a simple question: in a room of 23 people, what's the chance that at least two of them share a birthday? Most people guess something small, since 23 is tiny next to 365. The real answer is 50.7%, a little better than a coin flip.

23 people drawn as numbered dots in a circle, with the question: same birthday? More likely than not

What are the rules?

Every person's birthday is one of 365 days, each day equally likely, and one person's birthday tells you nothing about anyone else's. We leave out February 29. The question is whether any two people in the room have the same day, not whether someone shares your birthday in particular.

A grid of 365 days with 23 birthdays marked in mustard: it feels like a match should be rare

Why does it feel rare?

Picture 23 birthdays dropped on a calendar of 365 days. Most of the calendar stays empty, so a collision feels unlikely. But that picture counts people, and a match is never about one person. It's about two.

How many pairs are there?

Add the people one at a time and draw a line for every pair:

  • Person 2 makes one pair, with person 1.
  • Person 3 adds two more, one with each person already there.
  • Person 4 adds three more. That's 6 pairs from 4 people.

Four people joined by lines: person two makes one pair, three adds two, four adds three, 6 pairs so far

Each newcomer pairs with everyone already in the room, so person 23 adds 22 new pairs. In all: 1 + 2 + 3 + ... + 22 = 253 pairs. Each of those pairs matches 1 time in 365.

All 23 people joined to each other by 253 lines, one highlighted pair, each pair a 1 in 365 match

That's 253 chances for a match, not 23. (You can't just add up 253 chances of 1 in 365, because the pairs overlap: person 1 is in 22 of them. The next step gets the exact number.)

How do you get the exact chance?

It's easier to count the opposite: nobody matches. Play it out person by person.

  • Person 1 can have any birthday.
  • Person 2 must miss person 1's day: 364 of 365 days work.
  • Person 3 must miss both earlier days: 363 of 365.
  • ...and so on, each newcomer missing every earlier birthday, down to person 23, who has 343 free days of 365.

Multiply those chances together and you get the chance that all 23 birthdays are different. Everything else is a room where someone shares.

People in the room No match Someone shares
5 97.3% 2.7%
10 88.3% 11.7%
15 74.7% 25.3%
20 58.9% 41.1%
22 52.4% 47.6%
23 49.3% 50.7%

At 22 people the chance is still 47.6%. The 23rd person tips it past a half.

The bar after all 23 people: someone shares 50.7 percent, no match 49.3 percent, just past the halfway mark

Why is it so high?

Pairs grow much faster than people. Adding one person adds a pair with everyone already there, so 10 people make 45 pairs, 23 make 253, and every pair is another chance for a match.

The takeaway card: 23 people, 253 pairs

Check it with code

Count the pairs and the exact chance, then simulate a million rooms of 23 people:

from fractions import Fraction
import random

DAYS, N = 365, 23
pairs = [(j, k) for k in range(1, N + 1) for j in range(1, k)]   # person k pairs with everyone before
print('pairs:', len(pairs))

nobody = Fraction(1)
for k in range(N):                       # newcomer k+1 must miss the k birthdays already taken
    nobody *= Fraction(DAYS - k, DAYS)
print(f'shared: {float(1 - nobody):.4f}')
print(f'nobody: {float(nobody):.4f}')

rng = random.Random(8)
trials = 1_000_000
hit = sum(len(set(rng.randrange(DAYS) for _ in range(N))) < N for _ in range(trials))
print(f'simulated: {hit / trials:.4f}')

Output:

pairs: 253
shared: 0.5073
nobody: 0.4927
simulated: 0.5070

Try it

How many people do you need in the room for a 90% chance that two share a birthday? Change N in the code until the shared chance passes 0.9, or work it out from the table's pattern first and then check.