A birthday paradox calculator finds the chance that at least two people in a group share a birthday. The answer surprises most people: in a group of just 23, the chance is a little over 50 percent. Enter the size of the group to see the chance, or enter a target chance to see how many people you need. You can also change the number of days, to test other cases. It runs in your browser.
How to use the birthday paradox calculator
- Choose chance of a shared birthday or people needed.
- Enter the number of people, or the wanted chance.
- Leave the number of days at 365, or change it.
- Press Calculate.
The formula
The Wikipedia article on the birthday problem finds the chance that all the birthdays are different, and subtracts it from 1. For n people and 365 days, the chance of no match is the product of (1 − k ÷ 365) for k from 1 to n − 1, which is 365! ÷ (365ⁿ × (365 − n)!), and the chance of a match is p(n) = 1 minus that. For more than 365 people, the chance is 1.[1] The page also gives the version for d days, with d = 365 as the usual case.[1] The idea is simple: the second person must avoid one birthday, the third must avoid two, and so on, and the chances multiply. The calculator works out the product directly.
The surprising numbers
The page has a table of the chance of a shared birthday. For 5 people it is 2.7 percent, for 10 people 11.7 percent, for 20 people 41.1 percent, and for 23 people 50.7 percent. For 30 people it is 70.6 percent, for 40 people 89.1 percent, for 50 people 97.0 percent, and for 60 people 99.4 percent. With 70 people it reaches 99.9 percent, and with 100 people it is 99.99997 percent.[1] Our calculator gives the same figures. The result for 57 people, 99 percent, is not in the table of the page, and we worked it out by the same product. A group of 23 looks small, but it has 253 pairs of people, and each pair is a chance of a match.
Why it is called a paradox
It is not a paradox in the logical sense. It only seems wrong, because we think of the chance that someone shares our own birthday, which is small, and not of the chance that any two people share a birthday, which involves many pairs. The page notes that the number of pairs in a room of n people is n(n − 1) ÷ 2.[1] With 23 people there are 253 pairs, and with 70 there are 2,415, so the chances build up quickly.
The approximation
For quick work, the article gives the approximation p ≈ 1 − e^(−n(n−1) ÷ (2d)), and a simpler version, p ≈ n² ÷ (2d), that is useful for chances up to about one half. It also gives the inverse, n ≈ √(2d × ln(1 ÷ (1 − p))), for the number of people that you need for a chance p.[1] For 23 people and 365 days, the approximation gives 50.0 percent, a little under the exact 50.7. The calculator shows it beside the exact value. For a chance of 50 percent, the inverse gives about 22.5, which rounds up to 23.
People needed for a chance
In the second mode, the calculator finds the smallest group for which the chance is at least the target. For 50 percent it is 23, for 90 percent it is 41, for 99 percent it is 57, and for 99.9 percent it is 70. The page adds some related results: it takes 88 people for a better-than-even chance that three of them share a birthday, and 187 for four, and 3,064 people before everyone has a birthday that someone else shares, which is the strong form of the problem.[1] It also mentions that, for d days, the exact number of people is the square root of 2 d ln 2, rounded up, or that plus one.[1]
The assumptions
The page lists the simplifying assumptions: leap years, twins, selection effects and the seasonal and weekly variation of births are all left out, each birthday is equally likely among 365 days, and the birthdays are independent of one another.[1] It also states that a uniform distribution makes the chance of a collision as small as it can be, so any real variation raises the chance. This is why the result is a slightly low estimate for a real class of students.
Sharing your own birthday
The chance that one particular person shares a birthday with one of the other people in the group is much smaller. It is 1 − ((d − 1) ÷ d)^(n − 1), which is our own working. For 23 people it is about 5.9 percent, and you need about 253 others for a chance of one half. The calculator shows this result in the first mode, so that you can see the difference between the two questions.
Other uses
The same mathematics governs hash collisions, random identifiers and the chance of two items sharing a code. If you have d possible values and pick n of them at random, the chance of a repeat is the same as the birthday problem. With 10,000 possible values, you can expect a repeat after about 118 picks, which is the square root of 2d ln 2. The calculator lets you set d to any number up to 10,000 to test this.
Common mistakes
- Asking about your own birthday. That chance is much smaller.
- Adding probabilities. The chances of different pairs overlap, so do not add them.
- Forgetting the pairs. The number of pairs grows with the square of the group.
- Expecting exact real-world results. Real birthdays are not uniform.
What next
Use this often? Add Birthday Par to your Home screen.
Frequently asked questions
What is a birthday paradox calculator?
A tool that finds the chance that at least two people in a group share a birthday, or the group size needed for a wanted chance.
How many people are needed for a 50 percent chance?
23 people. The chance with 23 people is about 50.7 percent.
What is the birthday problem formula?
p(n) = 1 − 365! ÷ (365ⁿ × (365 − n)!). It is 1 minus the chance that all the birthdays are different.
Why is the chance so high with so few people?
Because the group has many pairs. 23 people make 253 pairs, and each pair might match.
Does the calculator include leap years?
No. It treats every day as equally likely, and ignores 29 February, twins and seasonal variation.
Sources
Was this tool helpful?
What went wrong?
We only receive the reason you pick, never what you typed into the tool.
Thanks for your feedback.