Skip to main content
ponderloop

Secret Santa Generator

Type the names, one per line, add any people who should not draw each other (a couple, a household) and press Draw: everyone gets exactly one person to buy for, nobody gets themselves and no excluded pair is ever matched. The example draws 6 people with 2 exclusion groups: Ava buys for Elena, Ben buys for Dev, Chloe buys for Femi, Dev buys for Ava, Elena buys for Chloe, Femi buys for Ben. Keep it secret by passing the phone so each person taps to see their own match, or copy a private link for each person. Nothing is uploaded, no emails are sent and there is no sign-up.

Updated By ponderloop editorial · How we checkRuns in your browser: nothing you enter is uploadedHow this tool works

6 names

    One group per line, names separated by a comma, & or /. Example: Ava, Ben

    Optional. Saved in this browser only, never uploaded. Clear removes it.

    Up to 100 names. Nothing is uploaded and no emails are sent.

    Your draw

    6 people drawn, 2 exclusion groups respected. Nobody drew themselves.

    Budget: $25 · Exchange date: Dec 20

    Show all matches (organizer)
    • Ava gives to Elena
    • Ben gives to Dev
    • Chloe gives to Femi
    • Dev gives to Ava
    • Elena gives to Chloe
    • Femi gives to Ben

    Pass the phone

    Each person taps to see only their own match, then hides it before the phone moves on.

    Private links

    Each link opens a page that reveals one person’s match. It is kept in the part after the # sign, so it is never sent to a server. The text is only scrambled, not encrypted: send each link to its owner only.

      How many valid draws a group has

      Draws where nobody picks themselves (derangements), compared with all possible orders. Exclusions remove some of these draws; a random shuffle is valid about one time in three.
      PeopleAll orders (n!)Nobody draws themselvesShare of all orders
      36233.3%
      424937.5%
      51204436.7%
      672026536.8%
      75,0401,85436.8%
      840,32014,83336.8%
      103,628,8001,334,96136.8%
      12479,001,600176,214,84136.8%

      How to write exclusions

      One group per line. Everyone named on a line cannot draw anyone else on that line (both directions on). Names must match the names list; capitals and extra spaces do not matter.
      LineBoth directions onBoth directions off
      Ava, Ben2 blocked draws1 blocked draw
      Ava & Ben & Chloe6 blocked draws2 blocked draws
      Ava / Ben2 blocked draws1 blocked draw
      Ava - Ben2 blocked draws1 blocked draw
      Ava and Ben2 blocked draws1 blocked draw

      What a private link contains

      A link for one person ends in #s1.… and holds that person's name, their match, the budget and the date. The part after the # is read by this page in the browser and is never sent to a server.
      PartExampleWhat it does
      prefixs1.Marks the format version.
      salt and checkfirst 4 bytesA 16-bit salt scrambles the rest; a 16-bit check catches a link that was cut off.
      payload31 characters hereGiver, receiver, budget and date as scrambled text. Scrambled, not encrypted: see the FAQ.

      How to draw Secret Santa names online

      1. Add the names. One name per line, at least 3 and up to 100. A repeated name is counted once.
      2. Add exclusions (optional). Put people who should not draw each other on the same line, separated by a comma, an ampersand or a slash. Leave “Both directions” ticked for couples; untick it to stop only the first name on the line from drawing the others.
      3. Set a budget and a date (optional). They are shown with every match and included in the private links.
      4. Press Draw. If the exclusions make a draw impossible, a message names the people who run out of options so you can relax one of the exclusions.
      5. Share the matches. Pass the phone around, copy a private link for each person and send it yourself, or open the organizer list. Press Draw again for a new draw, and send new links.

      Frequently asked questions

      Is the Secret Santa draw really random and fair?
      Yes. The names are shuffled with a Fisher–Yates shuffle driven by your browser’s cryptographic random number generator (crypto.getRandomValues), and a shuffle is accepted only if nobody has themselves and no excluded pair is matched. Every valid draw is then equally likely. With 6 people there are 265 draws where nobody gets themselves, before any exclusions.
      How do exclusions work for couples and households?
      Write each couple or household on one line, for example “Ava, Ben”. With “Both directions” ticked (the default) none of them can draw any other person on that line. If you untick it, only the first name on the line is blocked from drawing the others, which suits a one-way rule such as “last year’s match”. Exclusions are checked as hard rules, never as preferences.
      What does “impossible with these exclusions” mean?
      Every person needs a different person to give to. If some people between them have fewer allowed recipients than there are people, no draw can exist, and the message names those people and who is left. Two people who exclude each other cannot be drawn alone, and in a group of three, one excluded pair is already impossible. Remove or loosen one exclusion and draw again.
      Are the names or results sent anywhere?
      No. The draw runs in your browser, there is no server that receives names, and no emails are sent. Your list is not saved unless you tick “Remember this list on this device”, which keeps it in this browser only until you press Clear. If you allow analytics, the site learns that a button was pressed, never a name or a result.
      How secure are the private links?
      They are private from servers, not from a curious participant. The match sits in the part of the link after the # sign, which browsers do not send to any server, so this site never sees it. But the text is only scrambled with a fixed method, not encrypted, so anyone who knows the format, or reads this page’s code, can decode a link in seconds. Send each link only to its owner, and use the pass-the-phone mode when you do not trust everyone to leave it alone.
      Does an odd number of people matter?
      No. The draw is not made of pairs. Each person gives to one person and receives from one, so the group forms one loop or several, and any number from 3 up works. Two people drawing each other is possible when the group has loops of two; press Draw again if you want to avoid that. Groups of two are not offered, because both people would know their match.
      What if someone drops out after the draw?
      If nobody has opened a link yet, remove the name and draw again. If people already know their matches, open the organizer list: the person who was drawing for the one who dropped out can take over the dropout’s recipient, as long as that is not themselves or an excluded person. Otherwise redraw for everyone and send new links.
      Can I redraw, and how do I stop people peeking?
      Press Draw again for a completely new draw; links and cards from the earlier draw then no longer match, so send the new ones. The organizer list is hidden until you open it, and the pass-the-phone screen shows one match at a time behind a tap, then hides it again before the next person.
      How many names can it handle?
      Between 3 and 100 names. Names are treated as Unicode text, so right-to-left names such as Hebrew or Arabic read in the right direction.

      How it works

      Names are read one per line (or split at the commas of a single line), trimmed, with blank lines ignored and repeats counted once. Each exclusion line is split at commas, ampersands, slashes, plus signs, “ - ” or “ and ”, and each name is matched to the list ignoring case and extra spaces; a name that is not on the list is an error. A valid draw gives each giver one receiver with every receiver used once, no giver drawing themselves and no excluded pair. The tool first checks that one exists with Kuhn’s augmenting-path matching algorithm. If it does not, the failed search yields a Hall violator, a set of givers with fewer allowed recipients than members (Hall’s marriage theorem), and the message names them. Otherwise the list is shuffled with Fisher–Yates using unbiased random integers from crypto.getRandomValues, and the shuffle is accepted if it breaks no rule; accepted shuffles are uniform over all valid draws. After 300 rejected shuffles (very tight exclusions) the tool assigns givers one at a time, each choosing randomly among the recipients that still leave a valid draw possible; that always succeeds, but then the valid draws are not exactly equally likely. A private link is “s1.” plus the base64url of a 16-bit salt, a 16-bit check and the JSON of giver, receiver, budget and date, XOR-ed with a stream from the mulberry32 generator seeded by the salt. This hides the text from a glance and detects damage; it is not encryption. The static example uses a fixed seed so the page never changes between builds.

      Sources

      More: Random picks and gamesAll math & numbersAll toolsHome & DIY calculators