This Minecraft tutorial explains how to use the /setblock command with screenshots and step-by-step instructions.
You can replace a block with another block using the /setblock command in Minecraft. Let's explore how to use this cheat (game command).
* The version that it was added or removed, if applicable.
NOTE: Pocket Edition (PE), Xbox One, PS4, Nintendo Switch, and Windows 10 Edition are now called Bedrock Edition. We will continue to show them individually for version history.
- Java
- PE
- Xbox
- PS
- Nintendo
- Win10
- Edu
SetBlock Command in Minecraft Java Edition (PC/Mac)
In Minecraft Java Edition (PC/Mac) 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19 and 1.20, the syntax to replace a block with another block is:
/setblock <pos> <block> [destroy¦keep¦replace]
In Minecraft Java Edition (PC/Mac) 1.8, 1.9, 1.10, 1.11 and 1.12, the syntax to replace a block with another block is:
/setblock <x> <y> <z> <tileName> [dataValue] [oldBlockHandling] [dataTag]
Definitions
- pos or x y z is the x y z coordinate for the block to replace.
- tileName is name of the replacement block. (See Minecraft Item Names)
- dataValue is optional. It is the variation of the block if more than one type exists for that tileName. (See Minecraft Data Values)
- oldBlockHandling is optional. It tells the command how to replace the block. The default behavior is replace. It can be one of the following values:
- replace - Replaces the block, including air.
- keep - Replaces the block if the block was air.
- destroy - Replaces the block, including air. Old block will be dropped and can then be collected as if it was mined with a pickaxe or shovel.
- dataTag is optional. It is the data tag for the new block. It is a compound NBT tag such as {Potion:harming}.
SetBlock Command in Minecraft Pocket Edition (PE)
In Minecraft Pocket Edition (PE), the syntax to replace a block with another block is:
/setblock <position> <tileName> <blockStates> [replace¦destroy¦keep]
Definitions
- position is the x y z coordinate for the block to replace.
- tileName is name of the replacement block. (See Minecraft Item Names)
- blockStates replaces the old
tileData
parameter. It is enclosed in [ ]
and identifies specific properties of titleName such as ["color":"black"]
(See our Bedrock Fill generator for blockStates)
- replace is optional. It tells the command to replace the block, including air. This is the default behavior.
- keep is optional. It tells the command to replace the block if the block was air.
- destroy is optional. It tells the command to replace the block, including air. The old block will be dropped and can then be collected as if it was mined with a pickaxe or shovel.
SetBlock Command in Minecraft Xbox One Edition
In Minecraft Xbox One Edition, the syntax to replace a block with another block is:
/setblock <position> <tileName> <blockStates> [replace¦destroy¦keep]
Definitions
- position is the x y z coordinate for the block to replace.
- tileName is name of the replacement block. (See Minecraft Item Names)
- blockStates replaces the old
tileData
parameter. It is enclosed in [ ]
and identifies specific properties of titleName such as ["color":"black"]
(See our Bedrock Fill generator for blockStates)
- replace is optional. It tells the command to replace the block, including air. This is the default behavior.
- keep is optional. It tells the command to replace the block if the block was air.
- destroy is optional. It tells the command to replace the block, including air. The old block will be dropped and can then be collected as if it was mined with a pickaxe or shovel.
SetBlock Command in Minecraft PS4 Edition
In Minecraft PS4 Edition, the syntax to replace a block with another block is:
/setblock <position> <tileName> <blockStates> [replace¦destroy¦keep]
Definitions
- position is the x y z coordinate for the block to replace.
- tileName is name of the replacement block. (See Minecraft Item Names)
- blockStates replaces the old
tileData
parameter. It is enclosed in [ ]
and identifies specific properties of titleName such as ["color":"black"]
(See our Bedrock Fill generator for blockStates)
- replace is optional. It tells the command to replace the block, including air. This is the default behavior.
- keep is optional. It tells the command to replace the block if the block was air.
- destroy is optional. It tells the command to replace the block, including air. The old block will be dropped and can then be collected as if it was mined with a pickaxe or shovel.
SetBlock Command in Minecraft Nintendo Switch Edition
In Minecraft Nintendo Switch Edition, the syntax to replace a block with another block is:
/setblock <position> <tileName> <blockStates> [replace¦destroy¦keep]
Definitions
- position is the x y z coordinate for the block to replace.
- tileName is name of the replacement block. (See Minecraft Item Names)
- blockStates replaces the old
tileData
parameter. It is enclosed in [ ]
and identifies specific properties of titleName such as ["color":"black"]
(See our Bedrock Fill generator for blockStates)
- replace is optional. It tells the command to replace the block, including air. This is the default behavior.
- keep is optional. It tells the command to replace the block if the block was air.
- destroy is optional. It tells the command to replace the block, including air. The old block will be dropped and can then be collected as if it was mined with a pickaxe or shovel.
SetBlock Command in Minecraft Windows 10 Edition
In Minecraft Windows 10 Edition, the syntax to replace a block with another block is:
/setblock <position> <tileName> <blockStates> [replace¦destroy¦keep]
Definitions
- position is the x y z coordinate for the block to replace.
- tileName is name of the replacement block. (See Minecraft Item Names)
- blockStates replaces the old
tileData
parameter. It is enclosed in [ ]
and identifies specific properties of titleName such as ["color":"black"]
(See our Bedrock Fill generator for blockStates)
- replace is optional. It tells the command to replace the block, including air. This is the default behavior.
- keep is optional. It tells the command to replace the block if the block was air.
- destroy is optional. It tells the command to replace the block, including air. The old block will be dropped and can then be collected as if it was mined with a pickaxe or shovel.
SetBlock Command in Minecraft Education Edition
In Minecraft Education Edition, the syntax to replace a block with another block is:
/setblock <position> <tileName> [tileData] [replace¦destroy¦keep]
Definitions
- position is the x y z coordinate for the block to replace.
- tileName is name of the replacement block. (See Minecraft Item Names)
- tileData is optional. It is the data value for the replacement block. It identifies the variation of the block if more than one type exists for that tileName. (See Minecraft Data Values)
- replace is optional. It tells the command to replace the block, including air. This is the default behavior.
- keep is optional. It tells the command to replace the block if the block was air.
- destroy is optional. It tells the command to replace the block, including air. The old block will be dropped and can then be collected as if it was mined with a pickaxe or shovel.
- Java
- PE
- Xbox
- PS
- Nintendo
- Win10
- Edu
Example in Java Edition (PC/Mac) 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19 and 1.20
To replace a block that is 1 block East and 1 block South with birch planks in Minecraft 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19 and 1.20:
/setblock ~1 ~ ~1 birch_planks
To replace the block beneath you with prismarine stairs:
/setblock ~ ~-1 ~ prismarine_stairs
To replace the block at the coordinates (-209, 69, 2) with a jungle trapdoor:
/setblock -209 69 2 jungle_trapdoor
Example in Java Edition (PC/Mac) 1.11 and 1.12
To replace a block that is 1 block East and 1 block South with birch planks in Minecraft 1.11 and 1.12:
/setblock ~1 ~0 ~1 planks 2
To replace the block beneath you with a diamond block:
/setblock ~ ~-1 ~ diamond_block
To replace the block at the coordinates (-126, 65, 229) with obsidian:
/setblock -126 65 229 obsidian
Example in Pocket Edition (PE)
To replace a block that is 5 blocks West and 3 blocks South with lime carpet in Minecraft PE:
/setblock ~-5 ~0 ~3 carpet ["color":"lime"]
To replace the block beneath you with iron ore:
/setblock ~ ~-1 ~ iron_ore
To replace the block at the coordinates (22, 68, 36) with glowstone:
/setblock 22 68 36 glowstone
Example in Xbox One Edition
To replace a block that is 8 blocks East and 12 blocks South with purple concrete powder in Minecraft Xbox One Edition:
/setblock ~8 ~0 ~12 concrete_powder ["color":"purple"]
To replace the block beneath you with bedrock:
/setblock ~ ~-1 ~ bedrock
To replace the block at the coordinates (4, 61, -5) with a redstone lamp:
/setblock 4 61 -5 redstone_lamp
Example in PS4 Edition
To replace a block that is 2 blocks West and 7 blocks South with orange concrete in Minecraft PS4 Edition:
/setblock ~-2 ~0 ~7 concrete ["color":"orange"]
To replace the block beneath you with a honey block:
/setblock ~ ~-1 ~ honey_block
To replace the block at the coordinates (10, 64, -20) with a honeycomb block:
/setblock 10 64 -20 honeycomb_block
Example in Nintendo Switch Edition
To replace a block that is 9 blocks West and 2 blocks North with spruce planks in Minecraft Nintendo Switch Edition:
/setblock ~-9 ~0 ~-2 planks ["wood_type":"spruce"]
To replace the block beneath you with purple glazed terracotta:
/setblock ~ ~-1 ~ purple_glazed_terracotta
To replace the block at the coordinates (-7, 62, 29) with a sea lantern:
/setblock -7 62 29 sea_lantern
Example in Windows 10 Edition
To replace a block that is 16 blocks East and 4 blocks North with a purpur pillar in Minecraft Windows 10 Edition:
/setblock ~16 ~0 ~-4 purpur_block ["chisel_type":"lines"]
To replace the block beneath you with netherrack:
/setblock ~ ~-1 ~ netherrack
To replace the block at the coordinates (31, 64, 5) with soul sand:
/setblock 31 64 5 soul_sand
Example in Education Edition
To replace a block that is 2 blocks East and 7 blocks North with blue wool in Minecraft Education Edition:
/setblock ~2 ~0 ~-7 wool 11
To replace the block beneath you with glass:
/setblock ~ ~-1 ~ glass
To replace the block at the coordinates (8, 67, 26) with bedrock:
/setblock 8 67 26 bedrock
In this example, we will replace a block with birch planks using the following command:
Type the command in the chat window. As you are typing, you will see the command appear in the lower left corner of the game window. Press the Enter key to run the command.
Congratulations, you have learned how to use the /setblock command in Minecraft.