MC Commands

Minecraft Setblock Command Generator

Generate /setblock commands intuitively to manipulate blocks, block states, and block entity NBT data.

Use ~ for relative coordinates based on the execution location.

/setblock ~ ~ ~ minecraft:air replace

What this generator does

Search for a block, set its block states, NBT and placement mode, and the generator builds the /setblock command. The block list comes from each version's actual data, and the syntax changes around 1.13 (data values vs. block states, where NBT goes) and the 1.21.5 strict mode are handled for the version you pick.

Command Usage Examples

1. A chest with items inside

Places a chest holding 64 diamonds and 3 golden apples. Since 1.20.5 item counts are written count:64 instead of Count:64b.

1.20.5+/setblock ~ ~ ~ chest{Items:[{Slot:0b,id:"minecraft:diamond",count:64},{Slot:1b,id:"minecraft:golden_apple",count:3}]}
1.13 ~ 1.20.4/setblock ~ ~ ~ chest{Items:[{Slot:0b,id:"minecraft:diamond",Count:64b},{Slot:1b,id:"minecraft:golden_apple",Count:3b}]}

2. An observer facing up

Block states in square brackets set the direction. Since 1.13 add [facing=up] right after the block ID; in 1.11–1.12 add facing=up after a space.

1.13+/setblock ~ ~ ~ observer[facing=up]
1.11 ~ 1.12/setblock ~ ~ ~ observer facing=up

3. Break the existing block and place lava

destroy breaks the block that was there, drops it as an item with breaking sound and particles, then places the new block.

/setblock ~ ~ ~ lava destroy

4. A glowing sign with text

Since 1.20 signs have a front (front_text) and back (back_text). Since 1.21.5 the text is written directly as {text:...} instead of a quoted JSON string.

1.21.5+/setblock ~ ~ ~ oak_sign{front_text:{messages:[{text:"Welcome!",color:"gold"},"","",""],has_glowing_text:1b}}
1.20 ~ 1.21.4/setblock ~ ~ ~ oak_sign{front_text:{messages:['{"text":"Welcome!","color":"gold"}','""','""','""'],has_glowing_text:1b}}

5. Place a torch only if the spot is empty

keep only places the block if the spot is air. If something is already there, nothing changes and you see 'Could not set the block', which protects your map from accidental overwrites.

/setblock ~ ~ ~ torch keep

/setblock changes by version (Java Edition)

When a /setblock command from an old tutorial fails in a current version, it is usually because of these changes.

VersionChange
1.11Block states such as facing=up can be used instead of numeric data values.
1.13Data values were removed and each block got its own ID (for example wool 14 → red_wool). The syntax became <block>[states]{NBT} [mode].
1.18The buildable height grew from 0–255 to -64–319.
1.20Signs got a front and back, so front_text and back_text replace Text1.
1.20.5Item counts inside NBT changed from Count:64b to count:64, and components replaces tag.
1.21.5Added strict mode, and text inside NBT (signs and so on) is written as {text:...} instead of a JSON string.

How we checked: the commands and error messages on this page were run and confirmed by the site operator on our own Java server (except permission cases involving other players). Block and block state lists are extracted from the official server jar's data generator reports, and FAQ error messages are quoted from the game's language file (en_us). Last checked: November 2026.

Frequently Asked Questions (FAQ)

I get 'Could not set the block'.

The block did not change. Usually keep mode was used and a block is already there, or the same block and state are already placed.

I get 'Unknown block type'.

The block ID is wrong. Since 1.13, blocks once told apart by numbers like wool 14 have their own IDs like red_wool, so names from old tutorials often fail. Picking from the generator's search uses the exact ID.

I get 'Block ... does not have property ...'.

You used a block state that block does not have. For example, stone has no facing. A wrong value gives 'does not accept ... for ... property'. The generator only shows states the chosen block has.

I get 'That position is out of this world!'.

The height is outside the buildable range. Since 1.18 the Overworld allows -64 to 319; before that, 0 to 255. If the position is in an unloaded chunk you get 'That position is not loaded'.

What is the difference between replace, destroy and keep?

replace (default) overwrites whatever is there, destroy breaks the old block and drops it before placing, and keep only places into air. Since 1.21.5 there is also strict, which places without updating nearby blocks.

Items do not appear in a chest from an old tutorial.

The item format changed in 1.20.5. Write count:64 instead of Count:64b, and use components instead of tag. Choosing your version in the generator produces the right format.

How do I remove a block?

There is no separate remove command; you place air (minecraft:air) there, as in /setblock ~ ~-1 ~ air. For large areas, use /fill.

Useful values

Values people look up most often when placing blocks. All for Java Edition.

1. Common block states

· Stairs: oak_stairs[facing=north,half=top] · Log direction: oak_log[axis=x] · Lit furnace: furnace[lit=true] · Waterlogged slab: oak_slab[type=bottom,waterlogged=true] · Doors: place the bottom (oak_door[half=lower]) and top (oak_door[half=upper]) separately. Without half, only the bottom is placed.

2. Old data values and IDs since 1.13

· wool 14 → red_wool · stone 1 → granite · stone 3 → diorite · stone 5 → andesite · planks 1 → spruce_planks

3. Buildable height

· Overworld in 1.18+: -64 to 319 · 1.17 and earlier: 0 to 255 · Nether and End: 0 to 255