Skip to main content
Chris Ferrie

Is the Birthday Paradox Real?

Why 23 people in a room give you a 50:50 shot at a shared birthday—and what happens when you simulate it, swap in real U.S. birth data, or allow near misses.

BY CHRIS FERRIE •
Data: FiveThirtyEight / U.S. Social Security Administration (2000–2014, 62.2M births)
Interactive NotesTap or hover any dotted term (like or ) for a plain-English note, or open ? Tutorial on any figure for a guided walkthrough.

The birthday paradox goes as follows: in a room of just 23 people, there is a 50:50 chance that at least two of them share a birthday.

Why is this a paradox? Well, there is a 1/365 chance that another person shares your birthday. I don’t know anyone who shares my birthday. (Besides my twin, of course!) Since I’ve met far more than 23 people, how can this be true?

This reasoning is flawed for several reasons, the first of which is that the question wasn’t asking about whether there was another person in the room with a specific birthday—any pair of people (or more!) can share a birthday to increase the chances of the statement being true.

Part I • Intuition

Why 23 feels small, yet isn’t

When you walk into a room of 23 people and compare everyone solely against your own birthday, you are making only 22 comparisons. The chance someone shares your date is barely 5.9%. To give yourself a 50:50 shot at finding a birthday twin, you’d have to ask 253 other people.

But once we allow any two people in the room to match, the number of pairs grows :

Pairs =n(n − 1)2  →  23 · 222= 253At n = 23, you already have 253 independent-ish shots

Toggle between the two questions below to see how rapidly the comparison web fills in.

Figure I • The Intuition Trap

Why 23 People Create 253 Chances to Collide

You
23
Matches You
5.9%
22 pairs checked
Any Shared Pair
50.7%
253 pairs checked

Allowing any two people to match connects every person to every other person: n(n−1)/2 = 253 pairs. At 23 people, there are already 253 pairs—the very number needed to clear 50%!

The complete analytical answer involves a bit of combinatorial math, but I want to show you an even better way to convince yourself it is true: by simulating the experiment.

Simulation is programming a computer or model to act as if the real thing were happening. Usually, you set this up so that the cost of simulation is much lower than the cost of doing the actual thing—like putting a model airplane wing in a wind tunnel. I’ve simulated the birthday paradox in Python using a , and embedded a live version right below. Indeed, this is much easier than rounding up 23 people.

Part II • Monte Carlo

The simulation

Call the number of people we need to ask before we get a repeated birthday n. This is what is called a because its value is unknown in advance and may change due to conditions we cannot control (like who happens to walk into the room).

Now, we simulate an experiment, realizing a single value for n as follows:

Algorithm • Single Stopping-Time Trial
  1. Pick a random person and ask their birthday.
  2. Check whether someone else has already given you that answer.
  3. Repeat steps 1 and 2 until a birthday is said twice.
  4. Count the number of people who were asked and call that n.

Here is what the Python code looks like to simulate a single instance of this experiment using from a :

import numpy as np

def collect_until_repeat(dist=np.ones(365) / 365):
    # dist is the distribution of birthdays.
    # If it is not known, it is assumed uniform.
    repeat = False
    outcomes = np.zeros(dist.shape[0])
    # n counts the number of people we meet; each loop is a new person.
    n = 0

    while not repeat:
        n += 1
        outcomes += np.random.multinomial(1, dist)
        if np.any(outcomes > 1):
            repeat = True

    return n

Getting to step 4 constitutes a single experiment. The number that comes out might be n = 2 or n = 60—it all depends on who happens to be in the room. So we repeat all four steps many, many times and look at how the numbers fall. The more times we repeat, the more data we obtain and the clearer our picture of what is happening.

Try running single experiments or thousands of trials at once below, and watch the histogram lock onto the exact mathematical curve.

Figure II • Stopping-Time Simulation

How Many People Until the First Repeat?

Latest Single Experiment • Stopped at n = 18Repeat: Sep 12 (Person #8 & Person #18)
#1 Apr 19#2 Oct 3#3 Jan 27#4 Aug 11#5 Jun 5#6 Nov 29#7 Feb 14#8 Sep 12#9 May 8#10 Dec 2#11 Jul 21#12 Mar 16#13 Oct 18#14 Aug 4#15 Apr 30#16 Jan 9#17 Nov 14#18 Sep 12
0%1%2%3%50% split: n = 23210202330405060People asked before first shared birthday (n) — hover or click any bar
Trials Run
1,000
50% Split ()
n = 23
Exact: n = 23
Inspected Bar (n = 23)
3.60%
Exact: 3.160% (36 hits)
Cumulative ≤ 23
50.3%
Exact: 50.73%
First 50% of experimentsRemaining 50%
Inspect:

So what do all those numbers mean? Look at how often n = 2 occurs (click the n=2 pill above). In a one-million-trial run, the result 2 occurs roughly 2,726 times—about 0.273%. Notice how close that is to 1/365 ≈ 0.274%, which is expected since the probability that the second person has the same birthday as the first is exact 1/365.

Each bar’s height represents the probability that we would need to query that exact number of people to find our first shared birthday. Adding up every bar sums to 100% of all experiments.

Now add up the bars starting at n = 2 and moving right until you account for 50% of the total experiments—the . Visually, we are looking for the dividing line that splits the colored area above into two equal parts—vermilion on the left, indigo on the right. That number is the room size needed for a 50:50 shot at a repeated birthday.

Can you guess what it lands on?

Drum roll… 23! Tada! The birthday paradox—simulated and solved by simulation.

Part III • Real Data

But wait! There’s more

What about those leap-year babies? In fact, isn’t the assumption that birthdays follow a across the year completely wrong? If we actually tried this experiment out in real life, would we get 23—or some other number?

Happily, we can test this hypothesis with real data! At least for U.S. births, you can inspect 62.2 million real birth records from the Social Security Administration (2000–2014) on FiveThirtyEight’s GitHub page. Here is what the actual calendar distribution looks like—every single day of the year, including February 29.

Figure III • Real-World Data (62.2 Million U.S. Births)

Birthdays Are Far From Uniform—Yet 23 Refuses to Budge

Inspect date:
6k8k10k12kJanFebMarAprMayJunJulAugSepOctNovDecDaily mean (11,351/day)
December 25-43.3% vs. daily mean

Christmas Day — fewest U.S. births of any calendar day (−43%).

Avg / Day
6,438
Pop. Share
0.155%
Exact Comparison • Uniform (365 Days) vs. Real U.S. Births (366 Days incl. Feb 29)
50% Threshold (Median n)
23vs.23
Identical—both cross 50% at 23 people.
Match Odds at n = 23
50.73%vs.50.80%
Real births nudge odds up by just +0.07 pp.
Average People Until Repeat
24.62vs.24.59
Non-uniformity only ever eases collisions—slightly.

It certainly doesn’t look uniform to the eye! You can clearly see massive holiday dips on Christmas Day (Dec 25, down 43% from the daily mean), New Year’s Day (Jan 1), Christmas Eve (Dec 24), and July 4—plus subtle dips on New Year’s Eve, Halloween, and even the 13th of each month—balanced against a late-summer surge peaking on September 12.

Since far fewer people are born on major holidays, you might expect it to be easier to find a shared birthday crowded onto the remaining days. Will that noticeably change the birthday paradox?

Let’s test it: we perform the exact same 4-step experiment, but randomly sample answers from the real U.S. birthday distribution (you can switch Figure II above to Real U.S. Births (366d) and run 10,000 live trials yourself!).

And the answer is… the exact same! Mathematically, any departure from a uniform distribution can only push collision probabilities slightly upward (a result from : the uniform distribution minimizes the chance of repeats). Even with Leap Day added and dramatic holiday troughs, real U.S. birth data nudges the odds at n = 23 from 50.73% to 50.80%—a difference of less than a tenth of a percentage point. The birthday paradox persists stubbornly in the real world.

Part IV • Tolerance

So close!

If you are one of those people who get excited about “near” birthdays—born one day apart, or within the same weekend—I have good news! As you might expect, if we only need to find two people whose birthdays are close, we need a room with far fewer people.

We modify the experiment slightly to allow a for how far off we consider close. If tolerance = 0, we require the exact same birthday; if tolerance = 1, we allow a difference of a single day (wrapping cyclically across Dec 31 ↔ Jan 1); and so on.

Algorithm • Near-Birthday Stopping Trial
  1. Pick a random person and ask their birthday.
  2. Check whether someone else has already given a birthday within the tolerance window.
  3. Repeat steps 1 and 2 until successful.
  4. Count the number of people asked and call that n.

The updated Python code looks like this:

import numpy as np

def collect_until_near_repeat(dist=np.ones(365) / 365, tolerance=0):
    outcomes = np.zeros(dist.shape[0])
    n = 0
    days = len(outcomes)

    while True:
        n += 1
        outcomes += np.random.multinomial(1, dist)

        for i in range(days):
            # Exact repeat on the same calendar day
            if outcomes[i] > 1:
                return n
            # Near repeat within +/- tolerance cyclic days
            if tolerance > 0 and outcomes[i] > 0:
                for j in range(1, tolerance + 1):
                    if outcomes[(i + j) % days] > 0 or outcomes[(i - j) % days] > 0:
                        return n

Running across tolerances from 0 to ±7 days produces the curves and exact thresholds below. Notice how quickly the 50% line collapses—and what happens to a room of 20 people.

Figure IV • Near-Birthday Tolerance

How Fast the Paradox Collapses When “Close” Counts

20 people
Within ±1d
80.4%
50% at n = 14
Exact Match (0d)
41.1%
50% at n = 23
0%25%50%75%100%510152023304050Number of people in the room (n)
Tolerance50% Odds (n)Room of 2090% Odds (n)99% Odds (n)Mean n
Exact (0d)2341.1%415724.6
±1 day1480.4%243314.6
±2 days1193.9%192611.5
±3 days998.3%16229.8
±4 days899.5%14198.7
±5 days899.9%13178.0
±6 days7100.0%12167.4
±7 days7100.0%11156.9

Exact cyclic calendar probabilities (wrapping Dec 31 ↔ Jan 1 on a 365-day year). Click any row or curve to inspect its threshold.

Just allowing birthdays to be one day apart (±1 day) slashes the 50:50 threshold from 23 people down to 14, and sends a room of 20 people surging to 80.5%. Allow two days (±2) and 20 people reaches 93.9%; three days hits 98.3%.

In other words, if you allow “near” birthdays, you are all but guaranteed to find a pair in a room of roughly 20 people.

Part V • Try It Yourself

Step inside the room

For fun, have a go at the room simulator below. It draws a room full of birthdays—either from an idealized uniform calendar or directly from real U.S. birth records—with exact matches and near misses highlighted.

Try turning Highlight matches off first and scanning the room with your own eyes, then flip it back on—or click +1 Person to watch people file in one by one until a collision pops up.

Figure V • Interactive Room Simulator

Step Inside the Room & Spot the Matches Yourself

23 (253 pairs)
Tolerance (Near Misses)
Theoretical Odds
50.7%
Exact (0-day tolerance, 365d)
In This Room
1 pair
2 people matched (exact)
Tip: Uncheck Highlight matches to test your own eyes first, or click Test 1,000 Rooms to verify the odds empirically.
Aug16
Jan27
Mar19
Sep21
Jul8
Jan30
Oct24
Sep16
Sep25
Feb2
Dec23
Mar27
Jun14
Aug27
Jul25
Jan28
Jan6
Jul12
Apr8
Apr24
Apr21Exact
Dec7
Apr21Exact
Matched Pairs (1)
#21 Apr 21#23 Apr 21(same day)

Human intuition is notoriously terrible at counting pairs—we naturally compare the world against ourselves rather than across every combination in the room. Simulation cuts straight through that blind spot. You don’t need to take a textbook formula on faith when you can fill a thousand rooms in a fraction of a second and watch the 23-person threshold appear before your eyes.