Command blocks let you run game commands automatically when triggered

A command block is a special block in Minecraft that executes commands when activated. Unlike typing commands into the chat window yourself, a command block runs them on its own — triggered by a player walking nearby, by redstone power, or by another command block. You cannot craft or find command blocks in survival mode; you have to create them using a command, which means you need cheats turned on in your world.

Command blocks are most useful for building automated systems, creating mini-games, or setting up sequences that would be tedious to trigger manually. A single command block might teleport a player to a specific location, spawn mobs, change the weather, or give items to anyone who steps on a pressure plate. Chains of command blocks can do complex things — one block triggers the next, which triggers the next, letting you build elaborate contraptions.

Key Takeaways

  • You must enable cheats in your world settings before you can create or use command blocks.
  • Command blocks are created by typing a command in the chat window, not by crafting them like normal blocks.
  • Three types of command blocks exist — impulse, chain, and repeat — and each one triggers differently.
  • Command blocks only work in Creative mode or in Survival mode with cheats turned on.

Turn on cheats before you start

Command blocks require cheats to be active in your world. If you are starting a new world, the "Allow Cheats" option appears in the world creation screen before you generate the world. Toggle it on, then create the world normally.

If you already have a world without cheats, you cannot turn them on retroactively without using external tools. You have to create a new world with cheats enabled from the start. Once cheats are on, you can pause the game and open the chat window by pressing the forward slash key (/) on most keyboards.

Create a command block with a single command

Open the chat window and type this command exactly:

/give @s command_block

Press Enter. A command block appears in your inventory. Place it in the world like any other block. The block looks like a dark purple or gray cube with a question mark or circuit pattern on it, depending on your texture pack.

If you want multiple command blocks, you can repeat the command or change the number at the end: /give @s command_block 5 gives you five at once. The @s means "the player running this command" — so it always goes to you.

Right-click the block to open the command interface

Once the command block is placed, right-click it (or use your interact button on console). A window opens showing a text field where you can type the command you want the block to run. Type your command into this field — for example, /say Hello world makes the block broadcast a message to everyone on the server.

Below the text field, you see options for how the block behaves. The "Conditional" toggle makes the block only run if the previous block in a chain succeeded. The "Always Active" toggle determines whether the block runs every tick (game update) or only when powered by redstone. Leave these at their defaults until you understand what they do.

Click "Done" to save the command. The block is now ready to use.

Understand the three types of command blocks

When you first place a command block, it is an impulse block, shown in orange. Impulse blocks run their command once when powered by redstone or when you click them with a redstone dust or lever.

Chain blocks are green and run only when the block pointing into them (usually another command block) successfully completes. They are used to link commands in sequence — the first block runs, then the second, then the third, all in order.

Repeat blocks are blue and run their command every single game tick (20 times per second) as long as they are powered by redstone. Use these carefully because they can cause lag if the command is expensive. To change a block's type, right-click it, and you will see a dropdown menu at the top of the interface showing which type it currently is.

Power the block with redstone to make it run

An impulse command block does nothing until it receives redstone power. Place a lever next to it, a button, a pressure plate, or redstone dust connected to a power source. When the redstone activates, the command block runs its command once.

For a repeating setup, place a redstone block next to the command block (or use redstone dust powered by a lever you can toggle). As long as redstone power reaches the block, a repeat block will keep running its command every tick. Chain blocks do not need redstone power themselves — they run when the block before them completes.

Test your setup by activating the redstone power source. Watch the chat window or the world to see if your command executed. If nothing happened, check that the command is spelled correctly and that redstone power is actually reaching the block.

Common commands to try in your first blocks

/say [message] broadcasts text to everyone in the world. Replace [message] with whatever you want to say.

/give @a diamond 64 gives 64 diamonds to every player (@a means all players). Change "diamond" to any item name and "64" to any number.

/tp @s 100 64 200 teleports you to coordinates 100, 64, 200. Replace those numbers with the coordinates where you want to go.

/summon creeper ~ ~ ~ spawns a creeper at your current location. Replace "creeper" with any mob name — zombie, pig, dragon, etc.

/weather rain makes it rain. Use "clear" instead of "rain" for sunny weather.

Each command must start with a forward slash. If the command block shows a red X or the command does not run, the syntax is wrong — check the spelling and spacing carefully.

Frequently Asked Questions

Can I use command blocks in Survival mode without cheats?

No. Command blocks only work when cheats are enabled. If you want to use them in a world you care about, you must turn cheats on when you create the world. Turning cheats on does not prevent you from earning achievements in Java Edition, though it does in Bedrock Edition.

What is the difference between right-clicking and left-clicking a command block?

Right-clicking opens the command editor where you type or change the command. Left-clicking (or breaking it) destroys the block. If you want to edit a command you already entered, always right-click to open the interface again.

Why is my command block showing a red X?

A red X means the command has a syntax error — a typo, wrong spacing, or invalid command name. Check that the command starts with a forward slash, that all words are spelled correctly, and that you are using the right format for that command. The Minecraft wiki has a full list of valid commands and their correct syntax.

Can I copy a command block and paste the same command into another block?

Yes. In Java Edition, hold Ctrl and right-click a command block to copy it, then right-click where you want to place the copy. In Bedrock Edition, you can use the clone command or manually type the same command into a new block.

Do command blocks work on multiplayer servers?

Only if the server has cheats enabled and you have operator (op) status. A server owner can give you op status, which lets you use commands and command blocks. Without op status, you cannot create or edit command blocks even if cheats are on.