- You can get a command block in your Minecraft world using a special chat command.
- You'll need to have both Cheats and Creative Mode enabled in your Minecraft world to get a command block.
- Once you summon your command block, you can use codes to customize how it works.
- Visit Insider's Tech Reference library for more stories.
Minecraft is a surprisingly complex game. On the surface, it just looks like a big Lego simulator – but dig deep enough, and you can build sprawling rail systems, paint pictures, and even program in-game computers.
Command blocks are one of those complex features. Powered by redstone, command blocks let you automate the world, control players, set server rules, and more.
But unlike other items, you can't find command blocks out in the world, or in the full list of items. Instead, you'll need to spawn it into the game using cheats.
Here's how to get a command block in Minecraft, using either Java or Bedrock edition.
How to get a command block in Minecraft
The method to get a command block is pretty much the same in both Java and Bedrock.
1. Firstly, make sure that your world or Realms server has cheats turned on, and that you're playing in Creative Mode.
2. Open the chat box by pressing T on your keyboard, or the right d-pad button on a controller.
3. In the chat box, type:
/give [your username] minecraft:command_block
In place of "[your username]," insert your Minecraft username.
4. The command block will appear in your inventory. While it's in your hand, you can place it down on any solid surface.
Using the command block
Once you've placed your command block, you can set the block up with codes so it performs automatic tasks. These tasks include killing enemies as soon as they spawn, giving players items, and more.
1. Select the command block that you placed.
2. In the menu that opens, you'll have a few options. Use the first option to choose how often the command block should run: Impulse will run the command once and then stop, Repeat/Current will run the command indefinitely, and Chain will require any connected command block to run before it does.
3. The second option, Conditional or Unconditional, determines whether a connected command block needs to run successfully for this block to run.
4. The third option lets you choose whether the command block can run on its own - Always Active - or Needs Redstone to power it.
5. Finally, type your command into the text field. For example, if you want to kill every creeper in the area, you'll type:
/kill @e[type=minecraft:creeper]
You can find a list of common codes here.
6. When you're ready for the command block to start running, click Done.