Commands in Minecraft allow you to take full control of your world, from altering the weather and setting the time of day to spawning rare items and teleporting across biomes. Whether you play on Java Edition or Bedrock Edition, mastering the command line is an essential skill that transforms how you build, test, and manage your worlds.
Enable Cheats in Your World
Commands require cheat permissions before they can be executed. When creating a new world, set Allow Cheats to ON in the world creation menu.
If you are already in an existing world without cheats: on Java Edition, press Esc, select Open to LAN, toggle Allow Cheats: ON, and click Start LAN World. On Bedrock Edition, open Settings, scroll down to the Cheats section, and toggle Activate Cheats on.
Open the Command Line
To start entering a command, press / (forward slash) on your keyboard. Pressing slash automatically opens the chat window and inserts the slash prefix required for all commands. Alternatively, you can open chat with T on PC, right on the D-pad for consoles, or the chat icon on mobile screens, and type the slash manually. Learn more about controlling this menu in our guide on How to Open and Use Chat.
Learn Target Selectors
Many commands require you to specify who or what is affected. You can type an exact player name or use convenient target selectors:
@s: Targets yourself (the entity executing the command).@p: Targets the nearest player.@a: Targets all players in the world.@r: Targets a random player.@e: Targets all entities (including mobs, items on the ground, and minecarts).
Use Auto-Complete Suggestions
As you type a command, Minecraft displays inline prompts showing valid arguments and syntax. On Java Edition and Bedrock on PC, press the Tab key to automatically fill in the highlighted recommendation, coordinate, or item ID.
For example, if you want to switch modes, try using a selector with the How to Change Game Mode with a Command guide, or explore moving across the map with our tutorial on How to Teleport with a Command.
Execute the Command
Once your command syntax is complete, press Enter (or tap the send arrow on touch devices, or press the confirmation button on your controller). If the syntax is correct, the action will occur immediately and a confirmation message will appear in your chat log.
If there is an error, Minecraft displays red text pinpointing where the syntax failed so you can reopen the prompt and adjust your arguments.
Frequently Asked Questions
Why does Minecraft say "Unknown or incomplete command"?
This error means there is a typo in your command, a missing required argument, or an invalid target. Check the red highlighted portion of the prompt to see where the syntax broke, and use the Tab key to auto-complete valid options.
Can I use commands in a multiplayer server?
Yes, but only if the server owner has granted you operator permissions (level 2 or higher). On dedicated servers, the owner must type op YourUsername into the server console to grant you command access.
Do commands differ between Java and Bedrock Edition?
Basic commands like /tp, /time, and /weather work identically on both editions. However, advanced syntax for complex commands—such as /give with item components or block state formatting—has slight differences depending on whether you are running Java or Bedrock.








