Skip to main content

/setblock

Places a block at a specified position in the world. Can optionally destroy the existing block, keep it, or replace it.

Category
World
Permission Level
Game Master
Version Added
1.0

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 [destroy|keep|replace] and accepts 2 required arguments ( and ) and one optional argument ([mode]).

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 [destroy|keep|replace]. 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 and . The argument [mode] may be omitted, in which case the documented default applies.

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

NameTypeRequiredDescription
posblock_posRequiredThe coordinates where the block should be placed.
blockblock_stateRequiredThe block to place, optionally with block states (e.g., oak_stairs[facing=east]).
modeliteralOptionaldestroy = 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_block

Places a diamond block directly below you.

/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.

/setblock ~ ~ ~ air

Removes 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

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 [destroy|keep|replace]. The required arguments are pos and block, and the optional one is mode.

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