Worked example
8 people → 14,833 possible draws
Draw Secret Santa names without anyone peeking
-
Paste the whole group in one go
One name per line or separated by commas, so a list copied from a group chat works. It takes 3 people or more; 6 with no rules have 265 possible draws.
-
Keep couples from drawing each other
Tap Rules beside a name. Keeping Ana and Ben apart both ways leaves 168 of the 265 draws, and if a set of rules can’t work, it names the person causing it.
-
Run the gifts round one big circle
In one circle the gifts pass A → B → C and on back to A, with no closed little groups, so presents can be opened in turn. With the same rule, 72 draws fit.
-
Stop two people buying for each other
No swaps throws out any draw where two people got each other. Every draw that fits is equally likely: names are shuffled with your browser’s secure random numbers.
-
Skip last year’s pairings next December
A draw is saved only on the device that made it. Draw from the same phone or laptop at least 60 days later, and nobody gets the person they had last time.
-
Send each person only their own match
Each link opens one match, so nobody sees the whole draw, the organiser included. The budget, date and message ride in every link: changing them means resending, not redrawing.
Why drawing names from a hat goes wrong
When everyone draws from a hat at once, someone usually pulls their own name. With 8 people there are 40,320 ways the names can come out, and only 14,833 of them have nobody holding their own name. So 63.2% of hat draws need a redo. The chance barely changes with the size of the group: from 5 people up it stays at about 63.2% (it settles at 1 − 1/e).
A redo is not only slow. When the last person draws and only their own name is left, everyone has to start again, and the people who already looked know who they had. This generator never deals a draw where anyone has themselves.
| People | Possible draws | As one big circle |
|---|---|---|
| 3 | 2 | 2 |
| 4 | 9 | 6 |
| 5 | 44 | 24 |
| 6 | 265 | 120 |
| 7 | 1,854 | 720 |
| 8 | 14,833 | 5,040 |
| 9 | 133,496 | 40,320 |
| 10 | 1,334,961 | 362,880 |
| 12 | 176,214,841 | 39,916,800 |
How the draw stays fair
The names are shuffled with your browser’s secure random number generator, the same one used for encryption. If a shuffle breaks any rule, it is thrown away and the names are shuffled again. Because every shuffle is equally likely and only the good ones are kept, every draw that fits your rules is equally likely too.
The result card says how many possible draws fit your rules, counted exactly for up to 16 people (9 with No swaps on). Open Show the math to see the count for your own group.
When a draw is impossible
Some sets of rules leave no possible draw. Other generators just fail. This one tells you who causes it, for example: “Ann and Ben can only buy for Cat: 2 people, 1 person to buy for.” Two people can’t both buy for the same one person, so one of those rules has to go.
The check comes from Hall’s marriage theorem (Philip Hall, 1935): a draw exists exactly when every group of people is allowed to buy for at least as many people as are in the group.
Couples, swaps and one big circle
Rules cost fewer draws than people expect. Six people have 265 possible draws. Split them into three couples who can’t draw each other and 80 remain, still plenty to keep it a surprise. With only two couples, though, just 4 draws are left, so each person can make a fair guess.
- No swaps stops two people buying for each other. With 8 people, 8,988 of the 14,833 possible draws have no swaps.
- One big circle sends the gifts round the whole group in one loop, so you can open them in turn: Ann gives to Ben, Ben to Cat, and so on back to Ann. With 8 people there are 5,040 possible circles.
Keeping it secret
- Nobody sees the whole draw. After you press Draw names, the page shows who has a link, not who got whom. If you are only organising, I’m not taking part: show every match lists them.
- Each link shows one match. It opens a card that says who that person is buying for, with the budget, date, message and any gift hint for their person.
- The draw lives in the links, not on a server. Everything sits after the # in each link. Browsers never send that part to a server, so Toggle9 never receives the names. The names are scrambled so they don’t show in a chat preview, but this is not encryption: someone who opens another person’s link will see that match.
- Your organiser link holds the whole draw. Keep it to resend a lost link. Don’t post it in the group chat.
- Changed the budget, date or message after sending? The matches stay the same: the page lists whose links show the old details, so you can send just those again.
Avoiding last year’s match
After a draw, this browser remembers who had whom. When you open the generator with the same group 60 days or more later, a switch appears: Nobody gets the same person as the draw on that date. It is on by default. Draws on the same device in the same weeks don’t count, so redrawing this year’s exchange is never blocked. Each year it compares with the exchange just before, not the first one it saw. Clear saved data removes the memory.
Draw counts matched to OEIS A000166
A Secret Santa draw where nobody gets themselves is what mathematicians call a derangement, and the OEIS lists how many there are for each group size. The draw counter here works through every allowed pairing, and its count for 3 to 10 people must match the published sequence. Last run 19 November 2026.
| Example | Where it’s printed | The source’s answer | This calculator |
|---|---|---|---|
| 3 people, no other rules: possible draws | OEIS A000166 | 2 | 2 |
| 4 people, no other rules: possible draws | OEIS A000166 | 9 | 9 |
| 5 people, no other rules: possible draws | OEIS A000166 | 44 | 44 |
| 6 people, no other rules: possible draws | OEIS A000166 | 265 | 265 |
| 8 people, no other rules: possible draws | OEIS A000166 | 14,833 | 14,833 |
| 10 people, no other rules: possible draws | OEIS A000166 | 1,334,961 | 1,334,961 |
Questions
Can the organiser take part?
Yes. Add yourself like everyone else. After the draw the page never shows who got whom, so you find out your own match the same way as everyone else, from your own link.
What if someone loses their link?
Open the generator again from the same browser (the draw is in the page’s link and in Recent) and send that person’s link again. It is the same match. Don’t press Draw again: a new draw changes everyone’s match.
What if we draw in person?
Choose Print fold-over cards. Each card has a name on the outside and their match on the inside, upside down, so it can be folded and handed over without anyone seeing.
Can people read their match in another language?
Yes, in Spanish, French or Portuguese. Each link opens in the language the person’s phone or browser is set to, so a cousin in Mexico sees Tu amigo secreto es while you wrote the draw in English, and one tap switches the card back to English. Names, the budget and your message appear exactly as you typed them. This page, where you set up the draw, is in English.
Is there a limit on numbers?
Up to 100 people. Draws for any size take a moment. The exact count of possible draws is shown for groups of up to 16 (up to 9 with No swaps on), beyond which it gets very large.
Sources
- W3C Web Cryptography API, getRandomValues
- OEIS A000166, number of derangements
- P. Hall (1935), On Representatives of Subsets, Journal of the London Mathematical Society 10, 26–30
How sources are chosen and checked: editorial policy · these sources in the library, with the other tools that use them