Skip to main content

Secret Santa Randomizer

Generate a Secret Santa draw with no self-matches and optional same-household blocking.

Written by Golam Rabbani, Founder & Lead Engineer

One per line · use "Name | Household" to block same-household pairs · 4 entered

How to use this secret santa randomizer

  1. Enter participants one per line.
  2. Optionally add a household tag using "Name | Household" (e.g. "Alex | Smith") to block same-household matches.
  3. Tick Avoid same-household pairings if you used household tags.
  4. Press Draw to build the gift list.
  5. Reveal matches one at a time, or press Reveal all if you are the only person seeing them.

About this secret santa randomizer

The Secret Santa randomizer builds a valid derangement of your participant list — a permutation where no one is matched with themselves — using a cycle-based algorithm. It shuffles the participants with crypto.getRandomValues, then treats the shuffled list as a single cycle: person at position k gives to person at position k+1, with the last person looping back to the first. A single full cycle of length ≥ 2 is always a valid derangement, so the algorithm cannot accidentally produce a self-match.

If you turn on Avoid same-household pairings, the tool retries up to 300 shuffles until it finds a cycle where no neighbours share a household tag. With reasonable group sizes that converges in a handful of tries; with very small groups or many same-household members it may genuinely be impossible, and the tool tells you so rather than producing a broken draw.

For example, with participants [Alex|Smith, Bea|Smith, Chris|Lee, Dee] and household avoidance on, the tool might draw Alex → Chris, Chris → Bea, Bea → Dee, Dee → Alex — no one draws themselves and no two Smiths give to each other. Match rows stay hidden behind a Reveal button so one person can run the draw without seeing pairings.

FAQ

Does the algorithm guarantee no self-matches?
Yes. The cycle construction (k gives to k+1, last wraps to first) means a self-match is mathematically impossible whenever there are at least 2 participants.
How does household exclusion work?
Add "| HouseholdName" after a participant's name. With Avoid same-household pairings on, the tool retries shuffles until consecutive names in the cycle never share a household, up to 300 attempts.
What if no valid arrangement exists?
You will see an error. This usually happens when most participants share the same household — break the constraint or add more people.
Can the host see the matches?
They can if they reveal them, but matches are hidden by default. Each row shows a "reveal" button so participants can check their own match privately.
Is anything stored?
No. The draw runs in your browser and is forgotten the moment you close or refresh the page.