What is the birthday paradox probability that two people share a birthday in a group of 23 people
The birthday paradox: In a room of just 23 people, theres a chance that two people share a birthday.
I know its true but it FEELS wrong. There are 365 days in a year. With 23 people, thats only of the days.
The key is that were not checking if someone shares YOUR birthday. Were checking ANY pair.
The math:
For 23 people, this product is about , so .
My question: At what group size does the probability reach ? And does this have any real-world applications in cryptography or hashing? I heard about "birthday attacks" on hash functions.
1 answers2.1k views
2 comments
Mike JohnsonMay 7, 2026
i tested this in my class of 25 students and we DID have a shared birthday! freaky
Dr. Emily ParkMay 7, 2026
thats the paradox working as intended. with 25 people theres about a 57% chance.
Login to comment
1 Answer
**At what group size does $P(\text{match})$ reach 99%?**
Using the complement:
$$P(\text{no match}) = \prod_{k=0}^{n-1} \frac{365 - k}{365}$$
We want $P(\text{no match}) \leq 0.01$.
Solving: $n \approx 57$ or $58$.
For $n = 57$: $P(\text{match}) \approx 0.9901$
For $n = 60$: $P(\text{match}) \approx 0.9941$
**Real-world applications:**
1. **Birthday attack on hash functions:** A hash function with $m$ possible outputs has $50\%$ chance of collision after about $\sqrt{2m \ln 2} \approx 1.17\sqrt{m}$ random inputs. For SHA-256 (256-bit), thats about $2^{128}$ attempts — still computationally infeasible.
2. **Cryptographic nonces:** When generating random session IDs, the birthday paradox determines how many IDs you can generate before collision becomes likely.
3. **Database indexing:** If you insert random keys into a database, the birthday paradox determines when the first collision occurs.
The "paradox" isnt a logical contradiction — its just that human intuition about exponential growth is poor. We think linearly ("23 out of 365 = 6%") when we should think about pairs: $\binom{23}{2} = 253$ pairs, each with a $1/365$ chance of matching.
Login to comment