Command blocks are powerful tools that let you automate tasks and run commands in Minecraft. You can’t craft them or find them in Survival mode, you have to enable cheats (or be an operator) and use a command to get one.
This guide walks you through how to get a command block in Java Edition, Bedrock Edition and Dedicated servers.
TL;DR
Enable cheats or get operator permissions, then run:
- Java Edition:
/give YourName command_block - Bedrock & Education Edition:
/give @p command_block
Step 1: Enable Cheats
Before you can use commands, cheats must be turned on.
Java Edition (Singleplayer)
- When creating a world, toggle Allow Cheats: ON
- In an existing world:
PressEsc→ Open to LAN → Turn Allow Cheats: ON → Click Start LAN World
Bedrock Edition
- Pause the game → Go to Settings → Game tab → Toggle Activate Cheats: ON
Step 2: Get a Command Block
Now that cheats are enabled:
- Make sure you’re in Creative mode (run
/gamemode creativeif needed). - Open the chat (press
Tor use the chat icon). - Run the appropriate command:
Java Edition/give YourUsername command_block
ReplaceYourUsernamewith your Minecraft name.
Bedrock & Education Edition/give @p command_block
This gives the block to the nearest player (usually yourself). Press Enter. The command block will appear in your inventory. Drag it to your hotbar and place it in the world. Right-click (or tap) to open its settings.
Command Blocks on Dedicated Servers
If you’re playing on your own server or helping someone else set it up, here’s how to allow command blocks.
Java Edition (Dedicated Server)
- Enable command blocks:
- Open the
server.propertiesfile. - Find:
enable-command-block=false
Change it to:enable-command-block=true - Save and restart the server.
- Open the
- Become an operator (OP):
- In the server console, type:
op YourUsername
- In the server console, type:
- Give a command block:
- In game (as OP), run:
/give YourUsername minecraft:command_block
- In game (as OP), run:
Bedrock Edition (Dedicated Server)
- Enable cheats:
- Open
server.properties - Set:
allow-cheats=true - Save and restart the server
- Open
- Become an operator:
- In console or in-game, run:
op YourUsername - Or edit the
permissions.jsonfile manually:[{ "permission": "operator", "xuid": "YOUR_PLAYER_XUID" }]
- In console or in-game, run:
- Give a command block:
- In-game (as OP), run:
/give YourUsername command_block
- In-game (as OP), run:
Always restart the server after changing settings like server.properties or permissions.json to apply changes.
Extra Tips
- You can’t craft command blocks. There’s no recipe.
- They only work in Creative mode.
- Only operators can use or place command blocks on servers.
Frequently Asked Questions (FAQ)
Q: What if I want to use a dedicated server for command blocks?
A: Some players prefer managed hosting because it removes the technical setup. DatHost is a popular option for Minecraft Server Hosting because we provide fast setup, automatic backups, and an easy control panel. It’s especially useful for beginners or people who want a dedicated server without the hassle of configuring everything themselves.
Q: Why does Minecraft say “You don’t have permission to use this command”?
A: This happens when cheats are disabled or you’re not an operator on a server. Turn on cheats in world settings, or ask the server owner to make you an OP using the op <username> command.
Q: How do I open a command block after placing it?
A: Right-click (PC), press the “Use” button on console, or tap it on mobile. If nothing happens, you’re probably not in Creative mode or don’t have operator permissions.
Q: Why can’t I find command blocks in the Creative inventory?
A: Command blocks are hidden from the Creative inventory. You can only get them using the /give command, even in Creative mode.
Q: Can I use command blocks in Survival mode if I switch after placing them?
A: Yes. Command blocks will still run their commands in Survival mode, but you can’t break, pick up, or place new command blocks unless you return to Creative mode.