/setblock
Place a single block.
What is /setblock used for?
What /setblock is for
Places a single block at an exact coordinate, with optional block states and a keep/replace/destroy mode.
When to use /setblock
Place command blocks, set redstone components with precise orientations, or swap one block from a datapack function or a command-block clock.
Tips for /setblock
Include block states in brackets — e.g. minecraft:oak_log[axis=x] or minecraft:repeater[delay=4] — and use 'destroy' mode to drop the old block as an item.
Syntax
Parameters
- pos
- block coords
- Where to place the block.
- block
- block ID
- What to place.
- modeoptional
- literal
- destroy / keep / replace (default replace).
Command builder
Configure the options below to generate a ready-to-paste /setblock command.
Examples
Place a diamond block at your feet.
Place a command block at world spawn level.
Common questions
How do I place a command block?
Command blocks aren't in the creative menu. Get one with /give @s command_block, or place it directly with /setblock ~ ~ ~ command_block.
How do I set a block facing a certain direction?
Add block states in brackets, e.g. /setblock ~ ~ ~ oak_log[axis=x] or /setblock ~ ~ ~ repeater[delay=4,facing=north].
Permission level
/setblock requires Cheats (op level 2). In single-player you need the world's "Allow Cheats" toggle on. On a multiplayer server you need to be opped — see /op.