Skip to content
MoneyDeck

Secret Santa Generator

Draw Secret Santa names fairly, with couples and exclusions

Updated · Free, no signup

"Alice - Ben" stops both from drawing each other. "Alice > Ben" only stops Alice from drawing Ben.

Who buys for whom

Alice → Chloe
Ben → David
Chloe → Hugo
David → Farid
Emma → Grace
Farid → Ben
Grace → Emma
Hugo → Alice

Participants

8

Exclusion rules applied

4

Each one-way "cannot give to" rule counts once; a mutual pair counts twice.

Valid assignments possible

8,132

Chance a hat draw breaks a rule

79.83%

Probability that a random draw has someone with their own name or an excluded match.

  • 8,132 of the 40,320 possible draws satisfy every rule.
  • Drawing from a hat would need a redraw 79.83% of the time.

About the Secret Santa Generator

This Secret Santa generator draws names for a gift exchange in one click. Paste the participants, one per line, and the tool assigns every person someone to buy for so that nobody draws their own name and everyone receives exactly one gift. Add exclusions to stop partners, housemates or last year's pairs from drawing each other.

It works for office Secret Santa, family Christmas, Kris Kringle, Pollyanna, Wichtelen and any other gift exchange where each person buys for one other person. Unlike drawing slips from a hat, there is no need to redraw when someone pulls their own name — the tool searches for a valid assignment directly and tells you if your exclusions make one impossible.

For groups of up to 12 it also counts exactly how many valid assignments exist and how often a hat draw would fail, a classic derangement problem. Use a seed if an organiser needs to reproduce the same draw later; for a genuinely secret exchange, have one neutral person run the draw and message each giver privately.

How to use the secret santa generator

  1. 1Enter each participant on a new line.
  2. 2Add exclusions such as "Alice - Ben" for couples, or "Alice > Ben" for a one-way rule.
  3. 3Generate the draw.
  4. 4Send each giver their match privately — or have a neutral organiser do it.
  5. 5Add a seed if you need to recreate the same draw later.

Formula and method

Valid draws (no exclusions) = D(n) = (n − 1)(D(n − 1) + D(n − 2)), D(1) = 0, D(2) = 1 P(hat fails) = 1 − valid ÷ n!

A Secret Santa draw is a permutation that sends each giver to one receiver. With no exclusions the only rule is that nobody gets themselves, so the valid draws are the derangements D(n), and the chance that a random hat draw fails is 1 − D(n) ÷ n!, which quickly approaches 1 − 1/e ≈ 63.2%.

Exclusions remove further giver→receiver pairs. For up to 12 people the tool counts the remaining valid permutations exactly (the permanent of the allowed-pairs matrix, using a bitmask dynamic program). To draw, it first shuffles all names and keeps the result only if it breaks no rule (repeating up to 2,000 times), which makes every valid draw equally likely. If your exclusions make valid draws very rare, it switches to a randomised bipartite-matching search that is guaranteed to find an assignment whenever one exists, and otherwise reports that none is possible.

n
Number of participants
D(n)
Derangements: permutations where nobody maps to themselves
n!
All possible ways to hand out the names

Worked examples

Eight friends with two couples

Eight people can hand out names in 8! = 40,320 ways. Removing self-draws and the two couples' mutual pairs leaves 8,132 valid draws, so pulling names from a hat would break a rule about 79.8% of the time.

Family of four, no exclusions

Four people have 4! = 24 possible draws, of which D(4) = 9 leave nobody with their own name. A hat draw therefore fails 15 times in 24, or 62.5%.

Impossible exclusions

Ann may not give to or receive from Bob or Cat, and she cannot draw herself, so nobody is left for her. The tool reports that no valid draw exists instead of breaking a rule.

Frequently asked questions

How does a Secret Santa generator work?+

It randomly pairs each participant with one other person so everyone gives exactly one gift and receives exactly one. It never assigns someone to themselves and respects any exclusions you add, such as couples.

How do I stop couples from getting each other?+

Add a line such as "Alice - Ben" to the exclusions box. That blocks both directions. Use "Alice > Ben" if only Alice should be prevented from buying for Ben — for example last year's pairing.

Why does drawing names from a hat often fail?+

In a hat draw, the chance that at least one person pulls their own name is about 63% for any group bigger than four, because the share of valid draws D(n)/n! settles at 1/e ≈ 36.8%. Exclusions make redraws even more likely.

How many people do you need for Secret Santa?+

Technically two, but then each person simply buys for the other. With three, everyone can work out their Santa: if you buy for Ben, the third person must be buying for you. Four or more people keep the giver a genuine surprise.

Can I use this for a White Elephant gift exchange?+

A White Elephant (Yankee Swap) does not assign recipients: everyone brings one gift and players pick or steal in turn. Use the list randomizer to set the turn order instead; this tool is for exchanges where each person buys for one named person.

Is the draw secret?+

The result appears on the screen of whoever runs the draw. For full secrecy, have a neutral person run it and message each giver their match, or let each person look only at their own line.

Related tools