Secret Santa Generator

Randomly assign Secret Santa pairings so nobody draws themselves, using a proper derangement rather than a shuffle with retries.

Nearly two thirds of random shuffles are invalid

A valid Secret Santa draw is a shuffle where nobody gets their own name. Mathematicians call that a derangement, and the share of all shuffles that qualify settles on 1 ÷ e almost immediately:

PeopleValid drawsTotal shufflesShare valid
3 2 6 33.3333%
4 9 24 37.5000%
5 44 120 36.6667%
6 265 720 36.8056%
8 14,833 40,320 36.7882%
10 1,334,961 3,628,800 36.7879%
1 ÷ ethe limit36.7879%

By eight people the share matches 1 ÷ e to four decimal places. So a draw done by shuffling, with no self-match check, comes out invalid 63.2% of the time — not occasionally, but as the usual result. If you have ever pulled your own name out of a hat, that is why.

Just reshuffling is fine, and does not get worse with more people

The obvious fix is to shuffle, check, and shuffle again if anyone drew themselves. That sounds like it should get slower as the group grows — more people, more chances of a collision — and it is worth stating plainly that it does not.

PeopleChance a shuffle worksExpected attempts
3 33.33% 3.000
4 37.50% 2.667
5 36.67% 2.727
6 36.81% 2.717
8 36.79% 2.718
10 36.79% 2.718
15 36.79% 2.718
20 36.79% 2.718

The expected number of attempts converges on e = 2.718 and stays there. Twenty people are no harder than six. Three under three tries, every time, whatever the size of the office.

That is worth knowing because the instinct is to reach for something cleverer, and there is no need. Reshuffle-until-valid is simple, samples uniformly from all the valid draws, and costs almost nothing. It is what this generator does.

Why the circle method is worse than it looks

The other common approach is to sit everyone in a circle and have each person give to the next. It is always valid — nobody can be their own neighbour — and it is genuinely appealing because it needs no checking at all.

The catch is that it always produces a single closed chain running through everybody, and those are a shrinking minority of the valid draws. There are exactly (n−1)! of them:

PeopleValid drawsSingle-chain drawsShare
4 9 6 66.7%
5 44 24 54.5%
6 265 120 45.3%
7 1,854 720 38.8%

At four people a single chain covers 67% of the possibilities; by seven it is 39%, and it keeps falling. So the circle method draws from a narrow and shrinking slice of the space.

More practically, a single chain leaks. If you know who you are giving to, and you learn one other pairing, you can start unwinding the loop — and with a genuine chain there is exactly one loop to unwind. A properly random draw might break into two or three separate rings, and knowing one of them tells you nothing about the others. For a game whose entire point is that nobody knows, that difference is worth having.

How to use

  1. Enter everyone's names, one per line.
  2. Add exclusions for couples or households who should not draw each other.
  3. Generate the assignments.
  4. Share each person's result privately — not as a list.
  5. Agree a budget and a date before anyone starts shopping.

Frequently asked questions

How do you guarantee nobody draws themselves?

By generating a derangement — a permutation in which no element stays in its original position — rather than shuffling and hoping. Naive implementations reshuffle until nobody self-matches, which works but can subtly bias the result depending on how the retry is structured.

What are the odds a random shuffle happens to work?

About 37 per cent, and remarkably it barely depends on group size. The proportion of permutations that are derangements converges to one over e almost immediately, so a group of six and a group of sixty have nearly identical odds of a clean shuffle.

Can I stop couples drawing each other?

Yes, using exclusions. Adding constraints makes the underlying problem harder, and a heavily constrained small group can become genuinely impossible — at which point the only fix is to relax a constraint or add a person. The tool will say so rather than silently producing something invalid.

How do I keep it secret from myself as the organiser?

That is the awkward part of running one from a spreadsheet, and it is exactly why generating each person's result privately matters. If you assign everyone yourself, you know every pairing, which removes a fair share of the point for the person doing the work.

Should the assignments form one big loop?

It is one legitimate option — a single cycle means everybody sits in one chain with no mutual pairs, which some groups prefer. A derangement without further constraints may produce either a single cycle or several, so if it matters to your group it is worth specifying up front.

Does anything get uploaded?

No. Names and assignments are generated entirely in your browser and nothing is transmitted, which matters here more than usual — the entire premise depends on the results staying private.

What is a sensible budget?

Whatever the least comfortable person in the group can afford without thinking about it, which is usually lower than the figure someone proposes first. Agreeing it explicitly avoids the awkwardness of mismatched gifts, which is the most common way these end badly.

🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.