Basic syntax
/setblock <x> <y> <z> <block> [replace|keep|destroy|strict]
This syntax applies to Java 1.13 and later. The <…> arguments are required, and the final […] argument is optional.
| Argument | Meaning |
|---|---|
x y z | The placement position. 100 64 200 is absolute, and ~ ~-1 ~ is one block below the execution position. |
block | The block ID, optionally followed by [states] and then block entity {NBT}. |
Examples
Place stone one block below you
/setblock ~ ~-1 ~ minecraft:stone
Place east-facing stairs
/setblock ~ ~ ~2 minecraft:oak_stairs[facing=east,half=bottom]
Place glass only if the position is air
/setblock ~ ~ ~2 minecraft:glass keep
Placement modes
| Argument | Meaning |
|---|---|
replace | Replaces the existing block. This is the default. |
keep | Places a block only where the target is air. |
destroy | Breaks the original block before placing the new one. Drops depend on the block and game settings. |
strict | Java 1.21.5 and later. Places the block without triggering block or shape updates. |
Block states and version differences
Write properties together, as in [facing=east,half=bottom]. Available properties and values depend on the block.
In Java 1.21.5 and later, specify {} to explicitly clear existing block entity data. For example, /setblock ~ ~ ~2 minecraft:chest{}.
Java 1.12.2 and earlier use data values or older state syntax, depending on the version and block. Select your release in the generator.