Skip to main content
← All Guides
Server Commands

How to Use the /setblock Command

One command, one block, placed exactly where you point it. /setblock is the precise sibling of /fill, perfect for command blocks, contraptions and pixel-perfect builds.

The rule that matters
  1. 1
    Enable cheats or get op
    In a singleplayer world open to LAN with cheats on, or run /op YourName from the server console so the command is allowed.
  2. 2
    Pick your position
    Use ~ ~ ~ for your own spot, ~ ~1 ~ for one block above your feet, or hard numbers like 184 65 -212 for an exact location.
  3. 3
    Type the block id
    Add a namespaced id such as minecraft:redstone_block or stone. Tab-completion lists every valid id as you type.
  4. 4
    Add a block state (optional)
    Append states in square brackets, e.g. minecraft:oak_log[axis=x] or minecraft:repeater[facing=north,delay=4], to control orientation.
  5. 5
    Choose a handling mode
    End with destroy, keep, or replace. keep only fills air, destroy drops the old block, replace (default) overwrites silently.
Minecraft, Server Console
[12:04:07] [Server thread/INFO]: Console issued command:
>

What you need

/setblock command
~ ~ ~ coordinates
Block states
Command blocks

Quick answers

?
What is the full /setblock syntax?
/setblock <x> <y> <z> <block>[state] [destroy|keep|replace]. Coordinates accept ~ relative and ^ local notation, and the block id can carry a state list and NBT in newer versions.
?
What do destroy, keep and replace do?
replace (default) silently swaps the block. destroy breaks the old block first so it drops items and plays the break effect. keep only sets the block if the target is currently air.
?
How do I place a redstone_block above me?
Run /setblock ~ ~1 ~ minecraft:redstone_block. The ~1 raises the target one block over your feet so it lands at head height.
?
Can /setblock place oriented blocks?
Yes. Use block states: /setblock ~ ~ ~ minecraft:oak_stairs[facing=east,half=top] or minecraft:observer[facing=up] to set the exact rotation and shape.
?
Why does /setblock only place one block?
It is single-block by design. To fill a region use /fill <from> <to> <block>which takes the same handling modes and covers a whole cuboid at once.
?
Can a command block run /setblock?
Absolutely. Put /setblock ~ ~1 ~ redstone_block in an impulse or repeating command block, give it /gamerule commandBlockOutput control, and a redstone pulse fires it.
Database
Command Reference
Syntax, arguments and examples for every command.
Hosting
Managed Hosting
Skip the setup: a managed server online in minutes.
Database
Item Database
Every item with its stats, IDs, recipes and uses.
Guides
More Server & Admin guides
Run a server: setup, hosting, permissions, worlds and crossplay.