Secret Santa Draws, Explained

After reading this you will know exactly what a fair Secret Santa draw is, why some exclusion lists make a draw impossible, and how to run one that nobody can peek at.

What a Secret Santa draw actually is

A Secret Santa draw looks simple: everyone in a group buys one gift for one other person, secretly. The catch is the constraints. You should not draw yourself. If Anna is married to Ben, you probably do not want Anna buying for Ben. And each person should give exactly one gift and receive exactly one gift, so nobody ends up empty-handed and nobody buys two.

Put those rules together and you get a precise mathematical object. Draw an arrow from each giver to the person they buy for. Every name has exactly one arrow going out and exactly one arrow coming in. No arrow points at itself. And no arrow lands on an excluded partner. Such a set of arrows is called a perfect matching with no fixed points on the graph of allowed pairs.

Here is a hook. Take four people, Anna, Ben, Cara, Dan, with one rule: Anna and Ben must not draw each other. There are exactly 9 arrangements that satisfy every rule. If you dropped the Anna-Ben rule, there would be 9 arrangements where nobody draws themselves out of 24 total orderings. The exclusion happens to remove none of those 9 here, which already tells you that counting valid draws is not obvious. This article shows you how to count and how to draw.

When to use this, and when not

Use a generated draw when the group is larger than about five people, when there are exclusions, or when you want the result reproducible later. Hand-drawing names from a hat fails in three common ways: someone draws themselves and has to redraw (which leaks information), the organizer sees a name, or the exclusions are too tangled to satisfy by luck.

Do not use this tool for gift chains where you want one single loop through everyone (a Kris Kringle ring). This draw allows short cycles: Anna gives to Ben and Ben gives back to Anna is a valid two-cycle unless you exclude it. If you need one unbroken loop, that is a different constraint, called a Hamiltonian cycle, and it is not what this tool produces.

If you want couples to avoid each other and want to prevent the tiny two-person swaps between friends, add both directions as exclusions. Exclusions here already work both ways, so one line Anna, Ben blocks Anna to Ben and Ben to Anna at once.

The math: derangements and why exclusions matter

Start with the no-self-draw rule alone. A permutation of n people where nobody maps to themselves is called a derangement. The count of derangements is written !n:

!n = n! \sum_{k=0}^{n} \frac{(-1)^k}{k!}

Here n! is the number of ways to order n people, and the alternating sum strips out every arrangement that leaves at least one person fixed, using inclusion-exclusion. The symbol k runs over how many people are held fixed. A useful fact: !n is almost exactly n! / e, so roughly 36.8% of all orderings are valid no-self-draw assignments.

Total orderings versus valid no-self-draw draws
nn!!n (derangements)share valid
3620.3333
42490.3750
5120440.3667
67202650.3681

Every added exclusion removes more arrangements. If you exclude too many pairs, the count can drop to zero, and then no valid draw exists at all. The tool tells you when that happens rather than looping forever.

The count of valid draws (before exclusions) jumps from 2 at three people to 1854 at seven. Adding exclusions only reduces these counts.

How the tool finds a draw

The tool does not list all draws and pick one. That would be slow for large groups. Instead it uses randomized backtracking. It shuffles the givers into a random order (fixed by your draw number), then assigns each giver a receiver from the allowed pool, backing up whenever it paints itself into a corner. If any valid draw exists, this search finds one. If none exists, the search exhausts every branch and reports the list is impossible.

Two consequences follow. First, the result is a single valid draw, chosen with reproducible randomness, not a survey of all possible draws. Second, the draw number matters: the same names, the same exclusions, and the same draw number always return the same assignment. Change the number to reshuffle.

One person cannot be excluded from everyone else. If Cara is excluded from Anna, Ben, Dan, Erik and Fiona in a six-person group, she has nobody left to give to, and the tool will report no valid draw. Watch the total number of exclusions touching any single name.

Worked example: the six-person demo

Load the demo: participants Anna, Ben, Cara, Dan, Erik, Fiona, with exclusions Anna, Ben and Cara, Dan, and draw number 1.

  1. Six people give 720 total orderings. Removing self-draws leaves !6 = 265 derangements.
  2. Remove draws where Anna gives to Ben or Ben to Anna. By inclusion-exclusion on those two forbidden arrows, this cuts the count. Removing where Cara gives to Dan or Dan to Cara cuts it further.
  3. Counting carefully, the two exclusion pairs leave 198 valid assignments. The draw number selects one of them deterministically.
  4. Read the result as a list of giver to receiver arrows. Every name appears exactly once on the left and exactly once on the right, no self-arrows, and neither Anna-Ben nor Cara-Dan appears in either direction.

A sample valid assignment for this list is: Anna gives to Cara, Cara gives to Erik, Erik gives to Anna (a three-cycle), and Ben gives to Dan, Dan gives to Fiona, Fiona gives to Ben (another three-cycle). Check it: six givers, six receivers, no self-draws, and no forbidden pair. The tool's actual output for draw number 1 is one specific member of the 198.

With six people there are 265 no-self-draw assignments. Adding one two-way exclusion pair typically removes about 44 of them, leaving 221. Adding a second disjoint pair removes about the same again, leaving roughly 198. Piling on exclusions drives the count toward zero, at which point no draw is possible.

Reading and interpreting the result

The output is a list of arrows, one per giver. Do not read it as a ranking or a chain. Anna to Cara says only that Anna buys for Cara. It says nothing about who buys for Anna until you find Anna on the right-hand side elsewhere in the list.

The draw usually breaks into several cycles. Two three-cycles, one six-cycle, or a mix like a two-cycle plus a four-cycle are all valid. The number of cycles is not something you control here. If you specifically dislike two-cycles (direct swaps), exclude those pairs so the search avoids them.

Because the result is deterministic, save your draw number. If someone loses their assignment, rerun with the same names, exclusions and number to recover the exact same list without redrawing.

Common mistakes

Typing a name two different ways
Anna on the participant list and anna in an exclusion may be treated as different people. Keep spelling and capitalization identical.
Over-constraining one person
If a person is excluded from nearly everyone, the draw can become impossible. Count exclusions per name before running.
Expecting a single loop
This tool allows multiple cycles. It does not guarantee one unbroken chain through all participants.
Forgetting that exclusions are symmetric
One line blocks both directions. You do not need to write Anna, Ben and Ben, Anna.
Changing the list but reusing an old draw number expecting the same result
Determinism depends on the exact list and the number. Any change to names or exclusions can change the output even with the same number.

Related tools

If your event also needs people placed around tables with keep-together and keep-apart rules, the same style of constraint solving applies. The Seating Chart Optimizer assigns guests to tables while respecting who should sit near or far from whom, which is the seating cousin of the exclusion logic used here.

Frequently asked questions

Can two people draw each other?

Yes, unless you exclude that pair. Anna to Ben and Ben to Anna is a valid two-cycle. Add the pair as an exclusion if you want to prevent direct swaps.

Why does it say no valid draw exists?

Your exclusions rule out every possible assignment. Usually one person is excluded from too many others, or a small subgroup has no allowed target left. Remove an exclusion and try again.

Will the organizer see who buys for whom?

The draw is generated by the tool, not read aloud. As long as the organizer distributes each person's assignment privately, nobody, including the organizer, needs to memorize the full list. The draw number lets you regenerate it later without exposing it.

How many valid draws are there for my group?

For n people with no exclusions it is the derangement count !n: 44 for five people, 265 for six, 1854 for seven. Each two-way exclusion removes a chunk, so your true count is lower.

What does the draw number change?

It picks which valid assignment the search returns. The same number always gives the same draw. A different number reshuffles to a different valid draw from the same allowed set.