Turn on cheats for your world, open chat, and type a forward slash to run game mode, time, teleport and item commands. Below are the most useful commands, plus the syntax differences to watch for in Java and Bedrock.
How to Use Commands in Minecraft
Minecraft commands are typed into chat, start with a forward slash, and only work in a world with cheats turned on. In Minecraft, you can switch cheats on when you create a world or later in the world's settings, on both Java and Bedrock.
Turn On Cheats and Open Chat
- Turn on cheats for the world. On Bedrock, this permanently turns off achievements for that world, even if you switch cheats off again.
- Open chat. On PC, press T or the / key.
- Type the command. Press Tab to auto-complete command names and options, and the Up Arrow key to bring back the last command you ran.
On Bedrock, you also need the Operator Commands permission, which is on by default in worlds you create.
Most Useful Minecraft Commands
| Command | What It Does |
|---|---|
| /gamemode creative | Switches you to Creative. Also accepts survival, adventure or spectator. |
| /time set day | Sets the time. Also accepts night, noon, midnight or a number. |
| /weather clear | Clears the weather. Also accepts rain or thunder. |
| /tp 100 64 100 | Teleports you to those X, Y and Z coordinates. |
| /tp Steve Alex | Teleports the player Steve to the player Alex. |
| /give @s diamond 64 | Gives you 64 diamonds. Swap in any item ID and amount. |
| /difficulty peaceful | Sets difficulty. Also accepts easy, normal or hard. |
| /locate structure <name> | Shows the coordinates of the nearest structure, such as a village. |
| /locate biome <name> | Shows the coordinates of the nearest biome. |
| /setworldspawn | Makes your current spot the world spawn. |
| /help | Lists every command, or explains one with /help <command>. |
Java and Bedrock Differences
A few commands work differently between editions:
- Game mode shortcuts: Bedrock also accepts c, s and a, or the numbers 1, 0 and 2. Java only takes the full names.
- Time: Bedrock adds sunrise and sunset to the named times.
- Effects: On Java, /effect give @s minecraft:night_vision infinite gives endless night vision. On Bedrock, it is /effect @s night_vision infinite.
- Seed: Java has /seed to show your world seed. The seed guide explains what to do with it.
Building Commands
For building, /fill places one block across a whole area, and /clone copies a section of blocks to another spot. Both save time on the large projects in the build guide.
Keep Inventory and Other Game Rules
Game rules change how the world behaves. The one most players want is keep inventory, so you keep your items when you die.
Keep Inventory Commands
| Edition | Command |
|---|---|
| Java | /gamerule keep_inventory true |
| Bedrock | /gamerule keepinventory true |
Freeze Time and Weather
On Bedrock, /gamerule dodaylightcycle false freezes the time of day, and /gamerule doweathercycle false locks the current weather.
Java uses different rule names, so type /gamerule and press Tab to see the full list in your version.
Target Selectors
Swap a player name for a selector to target groups:
| Selector | Targets |
|---|---|
| @p | The nearest player |
| @a | All players |
| @r | A random player |
| @s | Yourself |
| @e | All entities, mobs included |
| @n | The nearest entity |
Server and Realm Permissions
On a shared server or Realm, most of these commands need operator permission. The Realms guide covers setting up a Realm.






