Setblock command generator

Place a block at a chosen position with the replace, destroy, or keep mode

How to use the Setblock command generator

  1. Choose the edition and version that match your game
  2. Specify the coordinates and choose the block to place
  3. Choose a mode: replace, destroy, or keep
  4. Copy the command and run it in Minecraft

This tool doesn't yet support block states (like stair direction) or Bedrock's data value — only block IDs and the basic modes are supported

Worked examples

The examples below come out of the same generator as the form above, so the commands and explanations always match what the tool produces. Copy one and adjust it from there

1. Place a single block in front of you

Unlike fill, setblock handles one block at a time — lighter, and the right choice for a single spot

/setblock ~ ~ ~1 minecraft:chest replace

What it does Will place block "Chest" at ~ ~ ~1, replacing the existing block.

2. Only place when the spot is empty

Keep mode refuses to overwrite what is already there — safer when a command block runs it repeatedly

/setblock ~ ~-1 ~ minecraft:glowstone keep

What it does Will place block "Glowstone" at ~ ~-1 ~, placing only if that position is empty.

3. Place a block at fixed coordinates

Absolute numbers put the block in the same place no matter where the command is run from

/setblock 0 65 0 minecraft:beacon replace

What it does Will place block "Beacon" at 0 65 0, replacing the existing block.

How this command differs by edition and version

This is the first example above, run through every edition and version this tool supports. Versions that produce the same result share a row

Every version this tool supports produces the same result, so a command you copy works without version-specific edits

Java Edition 1.21.5 and up Java Edition 1.20.5 - 1.21.4 Java Edition 1.13 - 1.20.4 (legacy NBT) Bedrock Edition (stable)
/setblock ~ ~ ~1 minecraft:chest replace

Before you use these