From Minecraft Wiki
Jump to: navigation, search


First introduced

Java Edition 1.7.2 (13w37a)
PE Alpha 0.16.0 (PE Alpha 0.16.0 build 1)

Changes a block to another block.


  • Java Edition
setblock <pos> <block> [destroy|keep|replace]
  • Bedrock Edition
setblock <position: x y z> <tileName: Block> [tileData: int] [destroy|keep|replace]


JE<from>: pos
BE: position: x y z: CommandPosition

In Java Edition, it must be a block position composed of <x>, <y> and <z>, each of which must be an integer or tilde and caret notation.In Bedrock Edition, it must be a three-dimensional coordinates composed of <x>, <y> and <z>, each of which must be a floating-point number or tilde and caret notation.
Specifies the position of the block to be changed.

JE<block>: block_state
BE: tileName: Block: Block

In Java Edition, it must be a block argument (does not accept block tags). In Bedrock Edition, it must be a block id.
Specifies the new block.

BE: tileData: int: int

Must be a 32-bit integer number. It must be between 0 and 65535 (inclusive).
Specifies the block data to use for the new block. Values that are invalid for the specified block id revert to 0. If not specified, defaults to 0.


Specifies how to handle the block change. Must be one of:
  • destroy — The old block drops both itself and its contents (as if destroyed by a player). Plays the appropriate block breaking noise.
  • keep — Only air blocks are changed (non-air blocks are unchanged).
  • replace — The old block drops neither itself nor any contents. Plays no sound.
If not specified, defaults to replace.


CommandTriggerJava EditionBedrock Edition
anythe arguments are not specified correctly Unparseable Failed
if sepicified position is unloaded or out of the world Failed
/setblock ... keepif tried to change a non-air block
/setblock ... keep
/setblock ... replace
if tried to replace a block with an identical copy (ignoring the block entity)
anyOn successChanges blocks at the specified position.


CommandEditionSituationSuccess Count/execute store success .../execute store result ...
anyJava EditionOn fail000
On success111
Bedrock EditionOn fail0N/AN/A
On success1N/AN/A


  • Put a chest facing east at your feet
  • Place a sign next to it in Java Edition
    • setblock ~ ~ ~-1 birch_sign{Text1:'"My chest"',Text2:'"Do not open!"'} (Note the two sets of quotes around the text. They are required.)

See also[edit]

  • /data — modifies the data tags of a block or entity
  • /clone — copies blocks from one region to another
  • /fill — fills a region with a block


Java Edition
1.7.213w37aAdded /setblock.
1.1116w32aAdded block state support to /setblock.
Pocket Edition Alpha
0.16.0build 1Added /setblock.