Command blocks let you run commands automatically when triggered

A command block is a special block in Minecraft that executes commands when activated. Unlike typing commands into the chat yourself, a command block can run the same command repeatedly, on a schedule, or when a player walks near it. You place it like any other block, but it only works in Creative mode or on servers where the owner has enabled them.

Command blocks are most useful for building adventure maps, setting up mini-games, or automating repetitive tasks. For example, you could set one to teleport all players to a specific location when they step on a pressure plate, or to give every player a certain item at the start of a game.

Key Takeaways

  • You must be in Creative mode and have cheats enabled to place and use command blocks.
  • Command blocks are found in the Creative inventory under the search term "command" or in the Redstone tab.
  • You activate a command block by powering it with redstone, either from a button, lever, pressure plate, or redstone dust.
  • The three types of command blocks (Impulse, Chain, and Repeat) determine how often and in what order commands run.
  • Command blocks only work in Creative mode, on multiplayer servers, or in worlds where cheats are turned on.

Finding and placing a command block

Open your Creative inventory and search for "command block" or navigate to the Redstone tab. You will see the command block listed there. Click it to grab one, then place it in your world like you would any other block. The block appears as a dark gray cube with a question mark or command symbol on it.

Command blocks only function in Creative mode or in a world where cheats are enabled. If you are in Survival mode without cheats on, the block will sit there but do nothing. To turn on cheats in a single-player world, pause the game, click "Open to LAN", toggle "Allow Cheats" to on, and then unpause. On a multiplayer server, the server owner must enable command blocks in the server settings.

Opening the command block interface

Right-click (or use your interact button) on the command block to open its interface. You will see a text field labeled "Console Command" where you type the command you want to run. Below that are dropdown menus for the command block type and conditional settings.

Type your command into the text field exactly as you would type it into the chat, but without the forward slash at the start. For example, to give a player a diamond sword, you would type give @s diamond_sword instead of /give @s diamond_sword. Click "Done" when you finish entering the command.

Understanding the three command block types

Impulse blocks run their command once each time they receive a redstone signal. This is the default type and works well for one-time actions like teleporting a player or displaying a message.

Repeat blocks run their command every game tick (20 times per second) as long as they are powered by redstone. Use these when you need something to happen continuously, like checking if a player is in a certain area or applying an effect to nearby entities.

Chain blocks run only after the command block pointing into them finishes. They let you link multiple commands together in sequence. For example, you could have an Impulse block teleport a player, then a Chain block give them an item, then another Chain block play a sound effect.

Powering a command block with redstone

A command block does nothing until it receives a redstone signal. You can power it by placing redstone dust next to it, running redstone dust from a lever or button, or placing a pressure plate on top of it. The type of power source determines when the command runs.

A button gives a brief pulse, so an Impulse block will run once when you press it. A lever stays on or off, so a Repeat block will run continuously while the lever is on. A pressure plate activates whenever something stands on it, making it useful for triggering commands when a player enters an area. Redstone dust can connect multiple command blocks together so they activate in sequence.

Common commands to use in command blocks

The give command adds items to a player's inventory: give @s diamond 64 gives the nearest player 64 diamonds. The teleport command moves a player to a location: teleport @s 100 64 200 moves the nearest player to coordinates 100, 64, 200. The effect command applies status effects: effect give @s speed 30 2 gives the nearest player Speed II for 30 seconds.

The say command broadcasts a message to all players: say Welcome to the arena! displays that text in chat. The execute command runs other commands based on conditions: execute if entity @a[distance=..10] runs a command only if a player is within 10 blocks. Learning these core commands opens up most of what command blocks can do.

Troubleshooting command blocks that do not work

If your command block is not running, first check that cheats are actually enabled. In single-player, pause and look for "Open to LAN" — if you see it, cheats are off. In multiplayer, ask the server owner to confirm command blocks are enabled in the server.properties file.

Next, verify the command block is receiving redstone power. Look for redstone dust or a powered block next to it; if you do not see any, add a button or lever nearby and test it. Finally, check your command syntax. A single typo or missing underscore will cause the command to fail silently. Open the command block again and read the command carefully, or test it in the chat first to see if it produces an error message.

Frequently Asked Questions

Can I use command blocks in Survival mode?

No, command blocks only work in Creative mode or on servers where the owner has enabled them. In regular Survival mode, the block will not execute any commands. You can turn on cheats in a single-player world to enable them, but this prevents you from earning achievements in that world.

What is the difference between a command block and typing commands in chat?

Typing commands in chat runs them once when you press Enter. A command block can run the same command repeatedly on a schedule, or whenever it receives a redstone signal. This lets you automate actions and build interactive contraptions without typing the same command over and over.

Do command blocks work on multiplayer servers?

Yes, if the server owner has enabled them in the server settings. Most public servers disable command blocks to prevent griefing. Private servers and servers designed for mini-games usually have them on. Ask the server owner or check the server rules to find out.

Can I use command blocks to give myself items in Survival mode?

No. Command blocks do not function in Survival mode at all. If you want to use commands to give yourself items, you must switch to Creative mode or enable cheats, both of which disable achievements for that world.

What happens if I type a command wrong in a command block?

The command block will not run, and no error message appears in chat. The block may show a red X or stay silent. Test your command in the chat first to see if it produces an error, then copy the working version into the command block.