/setblock
Places a block at a specified position in the world. Can optionally destroy the existing block, keep it, or replace it.
Overview
Places a block at a specified position in the world. Can optionally destroy the existing block, keep it, or replace it. In vanilla Minecraft Java Edition it is one of the world commands and has been available since version 1.0.
It is invoked as /setblock and accepts 2 required arguments (
Block states are specified in square brackets, e.g., chest[facing=north]. Use /setblock with air to effectively delete a block.
Block states go in square brackets as key=value pairs, e.g. oak_stairs[facing=east,half=top]. Placing 'air' deletes the existing block.
Syntax & Arguments
/setblock <pos> <block> [destroy|keep|replace]The full syntax is /setblock . Angle brackets < > mark required arguments and square brackets [ ] mark optional ones; a vertical bar | between words means you pick exactly one of those literals. You must always supply
- pos
- Required, of type a block_pos. The coordinates where the block should be placed.
- block
- Required, of type a block_state. The block to place, optionally with block states (e.g., oak_stairs[facing=east]).
- mode
- Optional, of type a literal. destroy = drops old block as item; keep = only places if target is air; replace = overwrites (default).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| pos | block_pos | Required | The coordinates where the block should be placed. |
| block | block_state | Required | The block to place, optionally with block states (e.g., oak_stairs[facing=east]). |
| mode | literal | Optional | destroy = drops old block as item; keep = only places if target is air; replace = overwrites (default). |
Examples
The 3 examples below are ready to copy and adapt. For instance, /setblock ~ ~-1 ~ minecraft:diamond_block places a diamond block directly below you. Each example varies the arguments to show a different real use of /setblock; read the note under every snippet to see exactly what changes.
/setblock ~ ~-1 ~ minecraft:diamond_blockPlaces a diamond block directly below you.
/setblock 0 64 0 minecraft:oak_stairs[facing=south,half=top] destroyPlaces a top-half south-facing oak stair at 0,64,0, destroying whatever was there.
/setblock ~ ~ ~ airRemoves the block at your position by replacing it with air.
Permission Level & Requirements
/setblock sits at permission Level 2 - Game Master / Cheats, which means it needs permission level 2, the level cheats grant to single-player worlds and that operators hold by default.
In a single-player world you must have "Allow Cheats" turned on (or open the world to LAN with cheats) before it will run; on a multiplayer server the player needs to be an operator at the matching level.
This reference describes the Java Edition 1.21 form of the command; Bedrock Edition may use slightly different argument formats.
Common Mistakes
- Using 'keep' mode and not realizing it silently fails if the position already has a non-air block.
- Forgetting block state syntax uses square brackets and key=value pairs separated by commas.
Notes
Block states are specified in square brackets, e.g., chest[facing=north]. Use /setblock with air to effectively delete a block.
Related Commands
If /setblock is part of your toolkit, the commands below are the ones you will most often reach for alongside it: /fill, /clone, and /data. They cover closely related tasks, so the links above jump straight to each one.
Frequently Asked Questions about /setblock
What does the /setblock command do in Minecraft?
Places a block at a specified position in the world. Can optionally destroy the existing block, keep it, or replace it. It belongs to the world command group and was added in Java Edition 1.0.
What is the correct syntax for /setblock?
/setblock
What permission level does /setblock need?
It requires permission Level 2 - Game Master / Cheats. On a server the player must be an operator at that level, or have cheats enabled in single-player.
What is a common mistake when using /setblock?
Using 'keep' mode and not realizing it silently fails if the position already has a non-air block.
Can you give an example of /setblock in use?
Yes. /setblock 0 64 0 minecraft:oak_stairs[facing=south,half=top] destroy — places a top-half south-facing oak stair at 0,64,0, destroying whatever was there.
Need a Minecraft server?
Try these commands on Astroworld or host your own server.
Try Astroworld Hosting