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
- 1Enable cheats or get opIn a singleplayer world open to LAN with cheats on, or run /op YourName from the server console so the command is allowed.
- 2Pick your positionUse ~ ~ ~ for your own spot, ~ ~1 ~ for one block above your feet, or hard numbers like 184 65 -212 for an exact location.
- 3Type the block idAdd a namespaced id such as minecraft:redstone_block or stone. Tab-completion lists every valid id as you type.
- 4Add 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.
- 5Choose a handling modeEnd with destroy, keep, or replace. keep only fills air, destroy drops the old block, replace (default) overwrites silently.
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.
/setblock at a glance
Syntax
/setblock <pos> <block> [destroy|keep|replace]Who may run it
OP (L2)
What it does
Places a block at a specified position in the world. Can optionally destroy the existing block, keep it, or…
Three things /setblock is actually used for
/setblock ~ ~-1 ~ minecraft:diamond_blockPuts a diamond block directly under your feet.
/setblock ~ ~ ~2 minecraft:chestPlaces a chest two blocks in front of you at your own height.
/setblock ~ ~1 ~ minecraft:redstone_torch keepOnly places the torch if that space is empty, because keep refuses to overwrite anything.
/setblock sits with the world commands in Minecraft, 9 of them in total. The ones with a guide here: /clone, /fill, /locate, /summon.
Every command with its full argument list lives in the command reference.
Blocks and items in this guide
All 7 of these are named in the guide above, starting with Diamond Block. Look them up in the item database.
More guides on this site
Guides that go with this one
How to Use the /fill Command in Minecraft
Fill any region with one block using /fill x y z x2 y2 z2 block. Learn solid, hollow, outline and...
How to Use the /clone Command in Minecraft
Copy any region to a new spot with /clone. Learn the source and destination syntax, the replace, masked,...
How to Use the /summon Command in Minecraft
Spawn any mob with /summon, set exact coordinates with ~ ~ ~, and customize it using NBT tags like...
How to Use the Teleport Command in Minecraft
Use /tp and /teleport to move players to another player, to exact coordinates, or with relative ~ ~ ~...
How to Set the World Spawn in Minecraft
Use /setworldspawn to fix where new players appear, and /spawnpoint to send specific players to a chosen...
How to Use the /execute Command in Minecraft
<> /execute is the most powerful command in Minecraft because it reshapes the context for any other...
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.