The command to get a command block depends on your game mode and version

In Minecraft Java Edition, you use /give @s command_block to place a command block in your inventory. In Bedrock Edition (the version on Windows 10, Xbox, Nintendo Switch, and mobile), the command is /give @s command_block as well, though the exact syntax can vary slightly by platform. You must be in Creative mode or have cheats enabled in your world to use either command.

Command blocks themselves do not exist in Survival mode without cheats turned on. If you are playing Survival and want to use command blocks, you need to enable cheats when you create the world or use the pause menu to turn them on mid-game. Once cheats are active, you can summon a command block into existence using the command above.

Key Takeaways

  • The command /give @s command_block adds a command block to your inventory in both Java and Bedrock editions.
  • You must have cheats enabled or be in Creative mode; command blocks do not work in pure Survival mode.
  • After you have the block in your inventory, you place it like any other block and then right-click it to open the command interface.
  • Command blocks execute commands automatically when powered by redstone, making them useful for building contraptions and automated systems.

Enabling cheats so you can use commands

If you are playing in Survival mode, cheats are off by default. To turn them on, pause your game and look for the option called "Allow Cheats" or similar wording depending on your version. Enabling cheats does not delete your world or change your progress — it simply allows you to type commands into the chat window.

In Java Edition, you can also enable cheats by opening your world to LAN (pause menu, then "Open to LAN") and toggling "Allow Cheats" there. This is useful if you want to keep the world's achievements disabled while still using commands. In Bedrock, the setting is usually in the world settings menu before you load the world, though you can also change it after creation.

Placing and using the command block once you have it

Once the command block is in your inventory, place it like you would any other block — right-click or use your place block button. The block will appear in the world with a dark purple or reddish texture depending on your version. Right-click on the placed block to open the command interface window.

Inside the window, you will see a text field where you type the command you want the block to execute. You can also set the block to "Repeat" mode (so it runs every game tick), "Chain" mode (so it runs commands in sequence), or "Impulse" mode (so it runs once when powered). Most command blocks need redstone power to activate, though you can change this setting in the interface.

The difference between command block types

Command blocks come in three types: Impulse (orange), Repeat (blue), and Chain (green). An Impulse block runs its command once each time it receives a redstone signal. A Repeat block runs its command every single game tick (20 times per second) as long as it is powered. A Chain block runs only after the command block before it in the chain has finished executing.

You choose the type when you open the command block interface. Most simple contraptions use Impulse blocks because they run once per signal. Repeat blocks are useful for continuous effects like spawning particles or checking conditions. Chain blocks let you string multiple commands together so they run in order, which is helpful for complex builds.

Common commands to use inside a command block

Some of the most useful commands are /summon (to spawn mobs or entities), /setblock (to place or remove blocks), /fill (to fill a large area with blocks), and /tp (to teleport players). You can also use /say to broadcast a message to all players, or /execute to run commands based on conditions like player location or time of day.

For example, /summon zombie ~ ~ ~1 spawns a zombie one block in front of the command block. /fill ~ ~ ~ ~10 ~ ~10 stone fills a 10-by-10 area with stone blocks. These commands are the same ones you would type into chat, but inside a command block they can be triggered automatically by redstone, making them much more powerful for building automated systems.

Why command blocks are useful for building

Command blocks let you automate tasks that would otherwise require manual work or complex redstone circuits. You can use them to create doors that open when a player steps on a pressure plate, spawn mobs in a specific pattern for a game, or build a system that changes the time of day or weather on command. They are especially useful in multiplayer worlds where you want to create interactive experiences for other players.

Because command blocks execute instantly and can run complex commands, they are also used in map-making and custom adventure maps. Many Minecraft YouTubers and content creators use command blocks to create special effects, teleport systems, and game mechanics that would be impossible with redstone alone.

Frequently Asked Questions

Can I use command blocks in Survival mode without enabling cheats?

No. Command blocks only work when cheats are enabled. Enabling cheats does not affect your world save or delete your progress — it simply unlocks the ability to use commands. You can turn cheats on at any time after creating your world.

What does the @s symbol mean in the give command?

The @s symbol means "the player executing the command" — in this case, you. So /give @s command_block gives the command block to yourself. You can replace @s with a specific player name like /give Steve command_block to give it to another player instead.

Do command blocks work the same way in Java and Bedrock editions?

They work very similarly, but there are small differences in syntax and available commands. Most basic commands like /summon and /setblock work the same way, but some advanced commands may behave differently. If a command does not work, check the documentation for your specific edition.

Can I copy and paste commands into a command block?

Yes. You can type or paste commands directly into the command block interface. This is useful for long or complex commands. Just right-click the block, click in the text field, and paste your command using Ctrl+V (or Cmd+V on Mac).