Updated:

Basic form

VersionCommand
Java Edition/spreadplayers 0 0 50 200 false @a
Bedrock Edition/spreadplayers 0 0 50 200 @a

This spreads everyone within 200 blocks of X=0, Z=0, at least 50 blocks apart. You do not give a Y value; players are placed on the ground.

Arguments

PositionExampleMeaning
1st and 2nd0 0Center X and Z (~ ~ for your position)
3rd50Minimum distance between players
4th200Maximum distance from the center
5th (Java)falseKeep teams together (true) or not

The area is a square around the center, not a circle.

Keep teams together (Java)

/spreadplayers 0 0 100 300 true @a

With true, members of the same team land together and teams are at least 100 blocks apart.

Stay under the Nether roof (Java 1.17+)

/execute in minecraft:the_nether run spreadplayers 0 0 30 150 under 100 false @a

Without under, players in the Nether can end up on top of the bedrock roof. under 100 only picks ground below Y=100.

Random teleport for one player

/spreadplayers ~ ~ 0 1000 false @s

With a spacing of 0 and only yourself as the target, this works as a random teleport (RTP) to dry ground within 1000 blocks. On Bedrock, drop false. Put it behind a button for a lobby "random spawn" sign.

Spread mobs and items too

/spreadplayers ~ ~ 5 40 false @e[type=minecraft:sheep]

Despite the name, the targets can be any entities. This scatters every sheep within 40 blocks of you, at least 5 blocks apart. Narrow the selector, for example with distance=..60, so you do not move animals from the whole loaded world.

A typical minigame start

/worldborder center 0 0
/worldborder set 600
/spreadplayers 0 0 60 250 true @a[team=!spectators]
/effect give @a minecraft:resistance 10 4 true

Keep the spread range smaller than half the border size (here 250 inside a 600-wide border) so nobody lands outside. The short Resistance effect protects players while they get their bearings. See the worldborder guide for shrinking the border later.

Common problems

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.