News
Game
Guides
Downloads
Versions
/setblock
COMMANDS BUILDING CHEATS · LEVEL 2 Added in 1.14 or earlier

/setblock command in Minecraft

/setblock places one block at a position, with exact block states and block entity data. Use it to set a chest that holds loot, an oriented stair or a ready-made command block, or to delete a single block by setting air.

Syntax

/setblock <pos> <block> [destroy|keep|replace|strict]
ArgumentExpectsWhat it does
posBlock coordinates (x y z)Position of the block, absolute like 10 64 10 or relative like ~ ~-1 ~ for the block under you.
blockBlock with statesBlock ID with optional states in brackets and data in braces, such as minecraft:chest{LootTable:"..."}.
All 5 forms
  • /setblock <pos> <block>
  • /setblock <pos> <block> destroy
  • /setblock <pos> <block> keep
  • /setblock <pos> <block> replace
  • /setblock <pos> <block> strict

Examples

A chest with dungeon loot

/setblock ~ ~ ~2 minecraft:chest{LootTable:"minecraft:chests/simple_dungeon"}

Places a chest two blocks away that fills with dungeon loot the first time it opens.

Java 26.3

Break the block under you

/setblock ~ ~-1 ~ minecraft:air destroy

Destroys the block below your feet and drops it as an item.

Java 26.3

An upside-down oak stair

/setblock 10 64 10 minecraft:oak_stairs[facing=east,half=top]

Places Oak Stairs upside down at 10 64 10, facing east.

Java 26.3

A torch only if the spot is free

/setblock ~ ~1 ~ minecraft:torch keep

Places a Torch above you, but only if that space is air.

Java 26.3
Build your command

Fill in the fields, then copy the command.

Command generator

The modes

  • replace (default): overwrites the block in place.
  • destroy: breaks the old block first, with particles and drops.
  • keep: only places the block if the position is air.
  • strict: places the block without triggering block updates.

"Could not set the block" usually means the block is already identical, or keep found something other than air.

Block states and data

States go in brackets: minecraft:oak_stairs[facing=east,half=top] places an upside-down Oak Stairs block facing east. Data goes in braces: minecraft:chest{LootTable:"minecraft:chests/simple_dungeon"} sets a Chest that fills with dungeon loot when opened, the same tables as /loot. A Command Block takes its command in {Command:"..."}. A misspelled ID returns "Unknown block type 'minecraft:oak_stair'".

Tips

~ ~-1 ~ targets the block under you. Relative coordinates start from where the command runs, so in a command block they start from the block itself. For many blocks at once, use /fill; to copy an existing build, /clone.

✓ Checked in Java Edition 26.3 · updated 2 November 2026

/setblock: FAQ

Why does /setblock say it could not set the block?

The block at that position is already exactly the same, or you used keep and the position was not air.

How do I remove a single block with /setblock?

Set it to minecraft:air. Add destroy if you want the old block to drop as an item.

How do I use /setblock?

Type it in the chat with cheats on: /setblock <pos> <block> [destroy|keep|replace|strict].

Who can use /setblock?

Cheats on, or operator level 2.

Copy & paste lists with /setblock

Related commands

/cloneCheats/placeCheats/fillbiomeCheats/fillCheats