Birthday Paradox

probability visualizer
Side project · 2026

See why 23 people is enough to share a birthday, the theory and a live simulation, side by side.

Birthday Paradox screenshot
Demo · running the simulator until the empirical estimate meets the curve

The birthday paradox is the standard example of a true thing that feels wrong: in a room of just 23 people, it's more likely than not that two of them share a birthday. Most people hear the answer, nod, and still don't believe it, because the explanation is a formula, and a formula doesn't move. I wanted something you could push on instead of read.

So this puts the math and the experiment in the same view. On one side is the exact probability curve; on the other is a Monte Carlo simulator that actually deals out random birthdays, trial after trial, and tallies how often a collision shows up. Watch the empirical number climb toward the theoretical one and the result stops being a claim you take on faith and starts being something you just saw happen.

What it shows you

What it assumes

Both the curve and the simulation treat the year as 365 equally likely days. That ignores February 29 and the seasonal clustering that real birth records show, which is the standard simplification for this problem and is stated in the app rather than left implied. Two notes under the charts carry the reason the answer is surprising: 23 people make C(23,2) = 253 pairs, and P(N) is one minus the probability that all N birthdays are distinct.

Built with

Vite · React 18 · TypeScript (strict) · Tailwind · Recharts. Four colour themes ship with it, Tokyo Night, Miami, Matcha and Gruvbox, remembered between visits. The probability math, the simulator and the seeded sampler all live in one file, src/math.ts. Static bundle on GitHub Pages, so it runs entirely in the browser with no backend.

← all projects