Random team and group generator

Paste the names, say how many groups or how many people per group, and get groups that differ by one person at most. Optional rules keep people apart or together and spread categories such as skill levels evenly.

This tool needs JavaScript. The rest of the page works without it.

One name per line, up to 500.

Off by default. The list is saved in this browser only and is never sent anywhere.

Split by

How many groups, or how many people per group at most, depending on the choice above.

Rules: keep apart, keep together, balance (optional)

Write names exactly as in the list above; capital letters and extra spaces do not matter. Leave a box empty to skip that rule.

One rule per line, names separated by commas, for example “Ann, Ben”. Nobody on a line shares a group with anyone else on that line.

One rule per line, names separated by commas. Everybody on a line ends up in the same group.

One category per line, for example “Beginners: Cy, Dee, Eve”. Every group gets the same share of each category, give or take one. People on no line are placed freely.

No groups yet

Your result will appear here.

What this tool does

It shuffles your list and cuts it into groups. You either set the number of groups or the largest number of people per group. Everybody is in exactly one group.

Three optional rules change which divisions are allowed: keep certain people apart, keep certain people together, and balance categories such as skill levels. Without rules, every division is allowed.

The list may hold up to 500 entries.

How to use it

  1. Enter the names, one per line.
  2. Choose whether the number below means the number of groups or the people per group, and enter the number.
  3. If you need rules, open “Rules: keep apart, keep together, balance” and write one rule per line, with the names as they appear in the list.
  4. Select “Make groups”. Select it again for a completely new division.
  5. Use “Copy result” to paste the groups into a message or a document.

The three rules

  • Keep apart: “Ann, Ben” means that Ann and Ben are in different groups. A line with three names keeps all three apart from each other, so it needs at least three groups.
  • Keep together: “Cy, Dee” puts Cy and Dee in the same group. Lines that share a name are joined: “Cy, Dee” and “Dee, Eve” keep all three together, and they must fit into one group.
  • Balance by category: “Strong: Ann, Ben, Cy” is a category named Strong. With c people in a category and g groups, every group gets c ÷ g of them, rounded down or up. Nine beginners in four groups means two or three beginners per group. People who are on no category line are placed freely.

The categories are whatever you write. The tool asks for no personal details and does not know what a label means; plain labels such as “Level 1” and “Level 2” work as well as names.

How the result is made

The whole list is shuffled once with the Fisher-Yates method and random values from the cryptographic generator of your browser. Every order of the list is equally likely. The shuffled list is then cut into pieces.

The sizes are as even as possible. The tool divides the number of names by the number of groups; if there is a remainder, the first groups get one person more. With “People per group”, the tool first calculates how many groups are needed so that no group is larger than your number, and then divides evenly.

With rules, the tool repeats the draw and throws away every division that breaks a rule, up to 20,000 times. Because each draw is completely random and only the allowed divisions are kept, every allowed division has the same chance. This is called rejection sampling.

Some rules allow so few divisions that 20,000 draws find none. The tool then searches for an allowed division, trying people and groups in random order. The groups still meet every rule, but they are not drawn with exactly equal chances, and the result says so. If the search also finds nothing, the tool names the problem instead of breaking a rule.

Worked example

A class of 23 is to work in groups of at most 5. 23 divided by 5 is 4.6, so 5 groups are needed. 23 divided by 5 groups is 4 with a remainder of 3, so three groups have 5 members and two have 4.

Group sizes for 23 names
SettingGroupsSizes
4 groups46, 6, 6, 5
5 people per group55, 5, 5, 4, 4
2 people per group12eleven pairs and one single

A coach splits 12 players into 3 teams of 4. The three strongest players go on one category line, “Strong: Ann, Ben, Cy”, so each team gets exactly one of them. Dee and Eve go on the keep-apart line.

There are 34,650 ways to split 12 people into three numbered teams of 4. In 10,080 of them the three strong players are on different teams, and in 7,560 of those Dee and Eve are also apart. So about one random division in five meets both rules, and the tool finds one after a handful of draws. Each of the 7,560 allowed divisions is equally likely.

Common mistakes

  • Expecting groups of exactly the entered size. If the numbers do not divide evenly, some groups are smaller by one. With pairs and an odd number of names, one person is left alone; add that person to a pair by hand.
  • Absent people in the list. Remove them first, otherwise a group is smaller than it looks.
  • A rule with a name that is spelled differently from the list. The tool stops and names the line, so fix the spelling there.
  • Rules that cannot all hold, such as a keep-together line with more people than a group has room for, or three people kept apart in two groups. The message names the rule to change.
  • Two people with the same name. With rules, each name must be unique; write “Sam K.” and “Sam L.”.

Frequently asked questions

Are the groups really random?
Yes. Without rules, every possible division into groups of these sizes is equally likely. With rules, every division that meets the rules is equally likely, unless the result notes that a search was needed. The order of your list has no influence.
Can I balance the teams by skill or gender?
Yes, with “Balance by category”: put each level on its own line, and every team gets an even share of each line. The tool only sees the names you write on a line; it does not ask for or guess anyone’s gender, age or ability.
Why does the tool say it could not meet the rules?
Because some rules exclude each other: for example a keep-together line that is larger than a group, or three people who must be apart when there are only two groups. The message names the line. Remove a rule or change the number of groups.
Can I get the same groups again later?
No. Nothing is stored and a draw cannot be repeated. Copy the result if you need it again.
Is the list of names uploaded?
No. The list and the rules are processed by your browser. The list is saved on your device only if you tick the box that remembers it; the rules are never saved.

Last updated: September 29, 2026