clock menu more-arrow no yes mobile

Filed under:

Minecraft: Guide to using Command Blocks

One of Minecraft’s most complicated features involves using a special block to implement commands automatically

Some purple Command Blocks behind black glass panes Image: Mojang/Microsoft via Polygon
Julia Lee (she/her) is a guides producer, writing guides for games like The Legend of Zelda: Tears of the Kingdom and Genshin Impact. She helped launch the Rift Herald in 2016.

Command Blocks are special blocks in Minecraft that you can use to execute commands. These can be customized to do a variety of things to automate things on your Minecraft server.

Players can do fairly complex things with Command Blocks, and they can be placed in a connecting chain to activate a series of commands to automate processes.

How to get a Command Block

Note that only server admins can make Command Blocks.

For Minecraft Bedrock Edition, you’ll need to do the following:

  1. Enable cheats in your world or Realm settings.
  2. Turn on Creative Mode in your world or Realm settings.
  3. Open the chat box and enter “/give [your username] command_block”
  4. Place the block where you want it.

You can turn off cheats and Creative Mode after you’re doing placing the blocks in your desired location.

For Minecraft Java Edition, you’ll need to do the following:

  1. Go to the “” file in your server’s config files.
  2. Change the line that says “enable-command-block=false” to “enable-command-block=true”
  3. Give yourself a Command Block by opening the chat box and entering “/give [your username] minecraft:command_block”
  4. Turn on Creative Mode by typing “/gamemode c” in your chat box.
  5. Place the Command Block where you want it.

You can turn the game back to Survival Mode by typing “/gamemode s” in the chat box after you place the block.

How to set up a Command Block

Once your Command Block is placed, there’s a couple settings you’ll see when you interact with it.

A Command Block prompt set to kill spiders
This is the Command Block prompt for Minecraft Bedrock Edition
Image: Mojang/Microsoft via Polygon

Choosing between “Impulse”, “Current” or “Repeat”, and “Chain” will decide when your Command Block activates.

Impulse will make the command run once and stop.

Current or Repeat (depending on your version) will make the command repeat consistently while powered.

Chain will make it so the block will only run after the connecting Command Block runs, allowing players to set up more complex systems.

A Command Block set at “Unconditional” will run no matter if the previous Command Block ran successfully. “Conditional” makes it so it’ll only run if the previous Command Block ran.

You can also set your Command Block up to be powered by Redstone. Selecting “Needs Redstone” will make it only activate if the block has Redstone. Selecting “Always Active” makes the command run regardless.

Whatever command you want set up goes into the “Command Input” section. You can use it to kill enemies if you don’t like a particular one or other things. Minecraft commands can be a little complicated at times, especially when using it in Command Blocks, but you can check out a list of commonly used commands here so you don’t have to do the heavy lifting yourself.

Sign up for the newsletter Sign up for Patch Notes

A weekly roundup of the best things from Polygon