Hourwiz Explains · video notes
The Birthday Paradox: Why 23 People Is Enough
Watch on YouTube (opens in a new tab)Instagram (opens in a new tab)Facebook (opens in a new tab)
The short answer: 23 people is all it takes. In a room of 23, the chance that at least two of them share a birthday is 50.73%, a bit better than a coin flip (our math, assuming 365 equally likely days). 23 is the smallest group that gets above 50%.
The answer: 23 people
Our math. Exact arithmetic with the standard birthday-problem formula (below), checked by our script. Wolfram MathWorld gives the same answer for 23 people: about 0.507297, and n = 23 is the smallest group with better-than-even odds.
| People in the room | Chance of a shared birthday |
|---|---|
| 22 | 47.57% |
| 23 | 50.73%: the smallest group above 50% |
| 45 | 94.10% |
| 70 | 99.92% |
A shared birthday means the same month and day. The year doesn't matter.
Why it feels wrong
- You picture someone matching you. In a room of 23, there are 22 other people to check your birthday against (23 − 1 = 22). That's 22 checks, which doesn't sound like much.
- But the match doesn't have to involve you. Anyone can match anyone. Each of the 23 people has 22 others to compare with, and every pair only counts once: 23 × 22 ÷ 2 = 253 pairs.
- So the room gets 253 chances at a match, not 22.
Our take: your gut counts 22 checks. The room has 253 pairs.
What about your birthday?
- For an even chance that someone shares your birthday, you need 253 other people. With 253 others, the chance is 50.05%. With 252, it's 49.91% (our math).
- That's the number your gut was picturing. It's also, by coincidence, the same as the number of pairs in a room of 23.
- 253 people give you about even odds, not a sure thing.
A real room: 45 presidents
- 45 people have served as US president. There have been 47 presidencies, because Grover Cleveland and Donald Trump each served two non-consecutive terms. We count each of them once: a man always shares a birthday with himself (Miller Center, the White House).
- Under the model, a group of 45 has a 94.10% chance of at least one shared birthday (our math).
- The real match: James K. Polk, the 11th president, was born on Nov. 2, 1795. Warren G. Harding, the 29th, was born on Nov. 2, 1865 (Miller Center; National Park Service).
- The only pair. The National Park Service says “Two presidents share a birthday.” Its article was last updated in 2021, so we checked all 45 birth dates on the Miller Center's pages ourselves: 45 people, 44 different month-days, and Nov. 2 is the only one that repeats.
- For the earliest presidents (George Washington, John Adams, Thomas Jefferson and James Madison), Miller Center gives the New Style (modern calendar) dates, and we used those.
Our take: it's not spooky. Under the model, a shared birthday among 45 people was a 94% bet.
Our test: a million rooms
Our test. We didn't just trust the formula. Our script (no outside libraries, run with Node v24.21.0 on Oct 17, 2026) built 1,000,000 random rooms for each case below. Each person gets a random day out of 365, then the script checks the room for a match. It uses a fixed seed (20261017), so a rerun gives the same numbers.
| What we simulated | Rooms with a match | Simulated | Exact math |
|---|---|---|---|
| Rooms of 23: any shared birthday | 507,558 of 1,000,000 | 50.76% | 50.73% |
| Rooms of 45: any shared birthday | 940,829 of 1,000,000 | 94.08% | 94.10% |
| You + 253 others: someone shares your birthday | 500,944 of 1,000,000 | 50.09% | 50.05% |
Each simulated result is within a few hundredths of a point of the exact value. The script checks this too: every result lands well inside normal random variation (less than 3 standard errors from the exact value).
The formula
The chance that at least two of n people share a birthday (Wolfram MathWorld):
P(shared) = 1 − 365! / ((365 − n)! · 365^n)
- The fraction is the chance that all n birthdays are different: the first person can have any day, the second has 364 of 365 days left, the third 363 of 365, and so on. Multiply those together, then subtract from 1.
- For “someone shares my birthday” among n other people, it's simpler: 1 − (364/365)n.
The core of our script
// P(at least two of n share a birthday) = 1 - prod_{k=0}^{n-1} (365-k)/365
function pAny(n) {
if (n > DAYS) return 1;
let none = 1;
for (let k = 0; k < n; k++) none *= (DAYS - k) / DAYS;
return 1 - none;
}
// P(at least one of n OTHER people shares YOUR birthday) = 1 - (364/365)^n
function pYours(n) {
return 1 - Math.pow((DAYS - 1) / DAYS, n);
}
An excerpt from our script, unchanged. The full file is in the download below.
What the math assumes
- 365 equally likely days. Every birthday is as likely as any other. MathWorld makes the same assumption: “the distribution of birthdays is assumed to be uniform throughout the year”.
- Leap day ignored. Feb. 29 isn't counted. MathWorld: “365-day years have been assumed, i.e., the existence of leap days is ignored”.
- Real-life patterns aren't modeled. The math treats every day of the year the same, and any seasonal pattern in real birth dates is left out. We didn't check real birth data, so this page makes no claim about how real birthdays are spread or how that would change these numbers.
- People are independent. One person's birthday tells you nothing about anyone else's.
Download our math
- Our script (.mjs, 9 KB): the exact math, the seeded simulation and the presidents check, the same file we ran for the video. Run it with Node (
node birthday-calc.mjs); it needs no outside libraries, and on our machine the simulation took under a second.
The script prints a few extra lines we don't use on this page. The presidents' birth dates in it are copied from each president's Miller Center page.
Images in the video
- James K. Polk: Brady studio / U.S. National Archives, 111-B-4542 (National Archives record; listed as unrestricted)
- Warren G. Harding: Harris & Ewing / Library of Congress (Library of Congress record; no known restrictions on publication)
Photos are shown unedited (cropped and resized only). Everything else in the video is drawn in code by Hourwiz.
Sources
Every fact on this page comes from these pages, opened on Oct 18, 2026. Things change: check the live page before you rely on it.
- Wolfram MathWorld, Birthday Problem The formula (eq. 5); about 0.507297 for 23 people; n = 23; 365-day years, leap days ignored, uniform birthdays.
- Harvey Mudd College, Math Fun Facts (Francis Su) You need “only 23 people to have at least a 50 percent chance of a match.”
- Miller Center, University of Virginia: the presidents 47 numbered presidencies, 45 people; Polk the 11th, Harding the 29th. We read the birth date on all 45 presidents' pages.
- Miller Center, James K. Polk Birth date: November 2, 1795.
- Miller Center, Warren G. Harding Birth date: November 2, 1865.
- National Park Service, on presidential births and deaths (Alan Gephardt, James A. Garfield National Historic Site) “Two presidents share a birthday”: Polk and Harding, Nov. 2.
- The White House, Donald J. Trump “45th & 47th President of the United States”.
Our numbers are exact arithmetic under the assumptions above, rounded as shown, plus one seeded simulation. Hourwiz is not affiliated with Wolfram MathWorld, Harvey Mudd College, the Miller Center, the National Park Service, the National Archives or the Library of Congress, and none of them made, reviewed or endorsed this page or the video.
No sponsor and no affiliate links on this page. Vendors are named so you can check them yourself, not as recommendations.
Follow Hourwiz
- YouTube@hourwiz (opens in a new tab)
- Instagram@hourwiz.ai (opens in a new tab)
- Facebookhourwizhq (opens in a new tab)
