Skip to content
Minecraft

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_block in chat. This works in Java and Bedrock. From the server console, use your player name instead of @s, such as give 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.

The three command block types in Minecraft
TypeColourWhen it runs
ImpulseOrangeOnce, each time it gets a signal. This is the default.
ChainCyanRight after the command block pointing into it has run.
RepeatPurpleEvery 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

  1. Place an impulse command block and put a stone button on it.
  2. Enter time set day and click Done.
  3. Place a chain command block against the front of the first one, where the arrow points. Enter weather clear.
  4. Press the button. It becomes day and the rain stops, in one go.

A healing spot at spawn

  1. Place a repeating command block under the floor at spawn and set it to Always Active.
  2. Enter effect give @a[distance=..8] minecraft:regeneration 3 0 true.
  3. Everyone within 8 blocks of the block now slowly heals. The true at 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_work in the console. The answer should be true.
  • Turn it on or off: gamerule command_blocks_work true or false. With false, 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-level in server.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.

Frequently asked questions

How do you get a command block in Minecraft?

Type /give @s minecraft:command_block in chat. You need cheats in singleplayer or operator rights on a server. In Java you can also turn on the Operator Items Tab under Options, Controls and take it from the Creative inventory.

Can you craft a command block?

No. A command block has no crafting recipe and can’t be found or mined in Survival. The only ways to get one are a command, the Creative inventory in Java, or copying an existing one with pick block.

Why does my command block not work on my server?

Check the game rule with gamerule command_blocks_work in the console; it should say true. Also check that the block has a redstone signal or is set to Always Active, and that you are an operator in Creative mode when you edit it.

Is enable-command-block still in server.properties?

No, not in current Java versions. Since 1.21.9 it is a game rule, now called command_blocks_work, and it is on by default. A fresh 26.3 server has no command block line in server.properties.

How do you stop command block messages in chat?

Type gamerule command_block_output false in the console or in chat as an operator. Command blocks keep working, but operators no longer get a message every time one runs.

More questions? See all frequently asked questions

Related articles