Shuffle first, then deal
The whole name list is shuffled with Fisher-Yates before anything is assigned. That algorithm walks the array from the end, and at each position swaps with a uniformly chosen position at or before it; every one of the possible orderings comes out with the same probability. It is worth naming because the obvious-looking alternative, sorting the array with a comparator that returns a random sign, is not a shuffle at all. That trick gives wildly uneven results depending on the sort implementation, and it is common enough in the wild to be worth avoiding on purpose.
Once shuffled, names are dealt round-robin: first name to the first team, second to the second, and back to the first when the teams run out. Since the order was already random, the deal adds nothing but even sizes.
What happens to the remainder
If the count does not divide evenly, the round-robin deal gives the extra people to the earliest teams, one each. The largest and smallest team therefore always differ by exactly one person, never more. Fifteen people into four teams gives 4, 4, 4, 3. Twenty-two into five gives 5, 5, 4, 4, 4. The result panel prints the sizes and says how many teams got an extra.
Which teams get the extra is not itself random, but it does not need to be: the names were shuffled first, so being on a four-person team rather than a three-person one is already a random outcome for any given person. If it matters which labelled team is the large one, rename them after the split.
Number of teams against people per team
| 14 people, split by | Teams made | Sizes |
|---|---|---|
| 4 teams | 4 | 4, 4, 3, 3 |
| 4 people per team | 4 | 4, 4, 3, 3 |
| 3 people per team | 5 | 3, 3, 3, 3, 2 |
Splitting by size rounds the team count up, so "four per team" from fourteen people means four teams that then even out to 4, 4, 3, 3 rather than three full teams and a pair. That was a deliberate choice: an under-filled last team of two is usually worse than two teams one person short. If you genuinely need three teams of exactly four, take two names out of the list before splitting.
Constraints the tool cannot handle
"These two must not be together", "spread the experienced people evenly", "balance by year group" are all outside what a flat shuffle does. There is one workable trick for the balancing case: split each subgroup separately and then merge the teams with matching labels, which gives every team a proportional share of each subgroup. For a keep-apart rule the practical answer is to look at the result and press again, since with more than a few teams you will usually get an acceptable split within a couple of tries.
The input accepts one name per line or names separated by commas, and mixes the two happily. Identical names are treated as two different people, so tidy up duplicates first if they are the same person typed twice. Nothing is stored, so copy the text block if the split needs to survive a page refresh.
Questions people ask
Can I lock a split so the same teams come back?
No. Every press reshuffles from scratch and there is no seed field. Copy the text block, which is formatted to paste into a message as it stands.
Can the teams be exactly equal?
Only when the number of people divides by the number of teams. Otherwise the difference is always exactly one person, which is the smallest it can be.
Does the order inside a team mean anything?
It is the order the shuffled list was dealt in, so it is random too. It is fine to read it as a within-team running order if you want one.
How many names can I paste?
Five hundred, and up to a hundred teams. Anything past that is trimmed and the result says so.