Birthday Paradox Explorer

shared birthday probability vs group size

Loading interactive simulation...

the paradox of pairs, not people 🖖

The paradox dissolves once you stop counting people and start counting pairs. With 23 people there are only 23 birthdays to compare, but C(23,2) = 253 distinct pairs that could each turn up a match — and it only takes one. Human intuition anchors on 'how many people are like me,' which grows linearly, while the quantity that actually matters, the number of pairwise comparisons, grows quadratically as n(nāˆ’1)/2. That's why the probability curve rockets upward so early: past n=23 you've already crossed 50%, and by n=57 it's over 99%, because you're feeding the problem O(n²) worth of opportunities to collide.

why we compute the opposite 🖖

Instead of tracking every way a match could appear, the tool asks the far easier reverse question: what's the chance everyone's birthday is different? Add people one at a time — the second must miss 1 taken day (364/365), the third must miss 2, and so on — then multiply those shrinking fractions and subtract from 100%. The takeaway: at 23 people the 'all different' chance finally dips below half, which is exactly why 23 is the tipping point.

the same math cracks cryptography 🖖

The identical logic quietly governs digital security. To break a hash function an attacker rarely needs a specific target — any two inputs that produce the same output will do, which is precisely the 'any pair' problem. So a hash with N possible outputs falls to a birthday attack after roughly √N attempts, not N. That's why a 256-bit hash gives only about 128 bits of collision resistance, and why designers must double the length to stay safe.

Example problems

  • office n=10 - n=10 -> 11.7% chance - feels safe, but 45 pairs are already being compared
  • class n=23 - n=23 -> 50.7% chance - the famous crossover: more likely than not
  • room n=30 - n=30 -> 70.6% chance - roughly 2-in-3 for a typical classroom
  • hall n=57 - n=57 -> 99.0% chance - near-certainty with just 57 people