It's about pairs, not you
The trap most people fall into is imagining the question as "what is the chance someone shares my birthday?" — a small chance, roughly 1 in 365 for each other person. But the birthday paradox asks a different question: what is the chance that any two of n people share a birthday? The number of distinct pairs in a group of n grows like n(n-1)/2, which is quadratic, not linear — with 23 people there are already 253 separate chances for a coincidence, and it only takes one of them to hit.
number of pairs: C(n,2) = n(n-1)/2 n = 23 -> 23*22/2 = 253 distinct pairs to check for a match
The exact formula
Rather than directly computing the probability of a match, it is far easier to compute the probability of no match at all and subtract from 1. Add people one at a time: the first can have any birthday, the second must avoid the first's (364 of 365 choices), the third must avoid both previous ones (363 of 365), and so on.
P(no match) = (365/365) * (364/365) * (363/365) * ... * ((365-n+1)/365) P(match) = 1 - P(no match) n = 23 -> P(match) ~ 50.7% n = 30 -> P(match) ~ 70.6% n = 57 -> P(match) ~ 99.0%
Why it grows so fast: the exponential approximation
Using the approximation 1 - x ~ e^-x for each small factor turns the product into a sum in the exponent, giving a clean closed-form estimate whose exponent scales with n squared — which is exactly why the probability rises so much faster than intuition expects. Setting this approximation to 0.5 and solving for n gives n ~ sqrt(2 * 365 * ln 2) ~ 22.99, which lines up almost exactly with the true threshold of 23.
P(match) ~ 1 - exp( -n(n-1) / (2*365) ) n for 50% chance ~ sqrt(2 * 365 * ln 2) ~ 22.99
Beyond birthdays: hash collisions
The same combinatorics govern birthday attacks on hash functions. A hash with b bits of output has 2^b possible values, and by the same reasoning as above, you expect to find two random inputs that collide after generating on the order of the square root of 2^b samples — not 2^b. This is precisely why cryptographic hash functions need roughly double the output length to resist collision attacks compared with what would be needed to resist a brute-force preimage search, and why 128-bit hashes like MD5 were considered broken for collision resistance long before anyone could realistically search anywhere near its full 2^128 space.
Frequently asked questions
Why does 23 people feel too small for a 50% chance?
Because people instinctively think about the chance that someone shares THEIR birthday, which is small (about 1 in 365 per comparison). The real question is whether ANY two of the 23 people share a birthday, and with 23 people there are 253 distinct pairs, each a small chance for a coincidence. It's the number of pairs, growing roughly with the square of the group size, that makes the probability climb so fast.
How many people are needed for a 99% chance of a shared birthday?
57 people. The probability of at least one shared birthday climbs steeply: about 50.7% at 23 people, about 70% at 30 people, and about 99.9% at 70 people, well before the group approaches the 366 people that would guarantee a match by the pigeonhole principle.
What does this have to do with cryptographic hash functions?
The same combinatorics apply to hash outputs: with a hash of b bits and therefore 2^b possible values, you expect to find two random inputs that hash to the same output after only about the square root of 2^b attempts, not 2^b. This 'birthday attack' is why collision-resistant hash functions need roughly double the bit length of what would be needed to resist a brute-force preimage search.
Try it live
Everything above runs in your browser — open Birthday Paradox and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Birthday Paradox simulation