How to get a command block in Minecraft and use it
Published on 27 October 2026
How to get a command block in Minecraft: you can’t craft or find one, so you give it to yourself with the command /give @s minecraft:command_block. That needs cheats in singleplayer or operator rights on a server, and you have to be in Creative mode to place and edit it. Below: the three types, two first builds and what changed on servers. Checked on a Minecraft Java 26.3 server on 27 October 2026.
How to get a command block in Minecraft
A command block is a block that runs a command, such as give or tp, when it gets a redstone signal. It can’t be crafted, mined or found in Survival. You get one in three ways:
- With a command. Type
/give @s minecraft:command_blockin chat. This works in Java and Bedrock. From the server console, use your player name instead of@s, such asgive Sanne minecraft:command_block. - From the Creative inventory (Java). Turn on Operator Items Tab under Options, Controls. The block then appears in the Operator Utilities tab.
- By copying one. In Creative, pick block on an existing command block gives you a copy. With Ctrl held down, the command inside comes along too.
In a singleplayer world you need cheats: Allow Cheats in Java, Activate Cheats in Bedrock. On a server you need to be an operator. To open and edit the block, you also have to be in Creative mode.
Impulse, chain and repeating
Right-click a placed command block to open its window. At the top you type the command, without a slash. Below it are three buttons that decide how the block behaves.
| Type | Colour | When it runs |
|---|---|---|
| Impulse | Orange | Once, each time it gets a signal. This is the default. |
| Chain | Cyan | Right after the command block pointing into it has run. |
| Repeat | Purple | Every game tick (20 times a second) while it’s active. |
The second button switches between Unconditional and Conditional. A conditional block only runs when the block behind it ran successfully. The third button is Needs Redstone or Always Active. Impulse and repeating blocks need redstone by default; chain blocks are always active, so a whole chain fires as soon as the first block does. The arrow on the block shows which way it points. A chain block has to be in front of that arrow.
Your first useful command block
Two builds that are handy on almost any server.
A button for clear weather
- Place an impulse command block and put a stone button on it.
- Enter
time set dayand click Done. - Place a chain command block against the front of the first one, where the arrow points. Enter
weather clear. - Press the button. It becomes day and the rain stops, in one go.
A healing spot at spawn
- Place a repeating command block under the floor at spawn and set it to Always Active.
- Enter
effect give @a[distance=..8] minecraft:regeneration 3 0 true. - Everyone within 8 blocks of the block now slowly heals. The
trueat the end hides the particles.
Command blocks run with permission level 2 in Java, so they can do most game commands, such as give, tp and gamemode. More commands to try are in useful Minecraft commands with examples.
Turn on command blocks on your server
Many older guides tell you to set enable-command-block=true in server.properties. That setting no longer exists in Java. Since 1.21.9 it’s a game rule, and since 1.21.11 that rule is called command_blocks_work. We checked it on a fresh Minecraft 26.3 server: server.properties has no command block line at all, and the game rule is on by default.
- Check it: type
gamerule command_blocks_workin the console. The answer should betrue. - Turn it on or off:
gamerule command_blocks_work trueorfalse. Withfalse, every command block on the server stops at once, which is the quickest fix when one runs wild. - Edit rights: only operators in Creative mode can open the window. The level a new op gets comes from
op-permission-levelinserver.properties, which is 4 by default. Level 2 is enough to edit command blocks.
In Bedrock, the switch is Command Blocks Enabled in the world settings, or the game rule commandblocksenabled.
Command blocks and safety
A command block is powerful, so treat it with some care on a shared world.
- Only op people you trust. Anyone who can edit a command block can give themselves anything. How op levels work is in Turn on the whitelist and add operators.
- Stop the chat spam. By default, command blocks report every command to operators. Turn that off with
gamerule command_block_output false. - Watch your repeating blocks. A repeating block runs 20 times a second. Dozens of them, or heavy commands, cost server performance.
- Protect the blocks. Players in Survival can’t break command blocks, but a griefer with op can. Make a backup before you build something big with them.
Prefer not to use command blocks for one rule? Many settings are a game rule too, such as keeping your items when you die: see how to turn on keep inventory.
Building a map or minigame for your friends? On your own Minecraft server you’re the operator: you op yourself in the console, set game rules and keep your world online when you log off. From €4.95 a month. See the Minecraft server plans.