# Secret Santa name drawer

Draw names for a Secret Santa in your browser. Nobody draws themselves, your exclusions are honoured, and each person sees only their own pick.

Use the tool on the [web page](https://giftideas.fyi/tools/secret-santa-drawer). It works without JavaScript.

## How to use it

1. Enter every name, one per line.
2. Add any exclusions, for example partners who should not draw each other.
3. Add a spending limit if you have one.
4. Draw names, then let each person reveal their own card, print the cards or copy the group link.

## How it works

Every person draws exactly one name and is drawn exactly once, and nobody draws themselves. Mathematicians call this a derangement.

The drawer first checks that a valid draw exists with your exclusions. If it does not, it names the people who are left with too few names to draw from and the exclusions that cause it.

It then builds the draw with a backtracking search: it fills the person with the fewest choices first and picks among their choices at random. The random numbers come from your browser's crypto.getRandomValues.

Everything runs on your device. Names are not sent to our server, saved or logged. The group link stores the draw after the # sign, and browsers do not send that part of a link to the server.

> The draw is random and happens on your device. Redraw if you need to; the previous draw is not kept.

## Questions

### Can someone draw their own name?

No. Every draw is checked so that nobody buys for themselves.

### How do I stop partners from drawing each other?

Add an exclusion for the pair and keep "Both ways" ticked. Neither partner can then draw the other. You can also exclude last year's pick in one direction only.

### Why does it say no draw works?

Too many exclusions can leave a group of people with fewer names to draw from than there are people in the group. This happens most with 3 or 4 names. Remove one of the exclusions it lists, or add more names.

### Do you store the names?

No. The draw happens in your browser tab and nothing is uploaded. Close the tab and the names are gone, unless you copied the group link.

### Is the group link private?

The link is not sent to our server, but anyone who has it can open every card. It works on trust. For a draw nobody can peek at, print the cards, fold them and hand them out.

### How many people can take part?

From 3 to 100 names. Each name must be different; add an initial to tell two people with the same name apart.
