Minecraft Commands Cheat Sheet: The Most Useful Commands for Java and Bedrock

Commands let you change the time, the weather, your game mode and much more by typing a single line in chat. This cheat sheet lists 18 commands that new players actually use, with examples you can copy for both Java Edition and Bedrock Edition. If you are not sure which edition you have, our Minecraft guide explains the difference between Java and Bedrock.
How to Turn On Commands
Commands only work in worlds where they are allowed.
- Java Edition: when creating a world, set Allow Commands (called Allow Cheats in older versions) to On. For an existing world, press Esc, choose Open to LAN, turn Allow Commands on and click Start LAN World. This lasts until you leave the world.
- Bedrock Edition: open the world settings and turn on Cheats. Bedrock warns you that achievements will be turned off for that world, and this cannot be undone.
- Servers and Realms: you need operator permission from the owner.
Press T or / on PC to open chat, or tap the chat button on phones and consoles, then type the command.
Target Selectors in One Minute
Many commands need a target. Instead of typing a player name you can use a selector:
- @s means yourself.
- @p means the nearest player.
- @a means all players.
- @e means all entities (mobs, items and players).
- @r means a random player.
Game Mode and Difficulty
/gamemode creativeswitches you to Creative. Usesurvival,adventureorspectatorfor the other modes. Bedrock also accepts short forms such as/gamemode c./difficulty peacefulremoves hostile mobs. The other options areeasy,normalandhard./defaultgamemode survivalsets the mode new players get when they join.
Time and Weather
/time set dayjumps to morning. You can also usenoon,nightormidnight./time set 0sets the clock to sunrise using game ticks. One day is 24000 ticks./weather clearstops rain and thunder. Userainorthunderto start them.
Teleport and Spawn Points
/tp @s 100 70 -200teleports you to those X, Y and Z coordinates./tp @s PlayerNameteleports you to another player./spawnpointsets your respawn point where you are standing./setworldspawnsets the spawn point for the whole world.
Items, Experience and Effects
/give @s diamond 64gives you 64 diamonds. Replace the item name with any item ID./clear @sempties your inventory. Be careful, there is no undo.- Java:
/xp add @s 30 levels. Bedrock:/xp 30L @s. Both add 30 experience levels. - Java:
/effect give @s night_vision infinite. Bedrock:/effect @s night_vision 99999. Both let you see in the dark for a very long time. /enchant @s sharpness 3enchants the item in your hand if that enchantment fits it.
Finding Places
- Java:
/locate structure village_plains. Bedrock:/locate structure village. The game replies with the coordinates of the nearest one. - Java:
/locate biome cherry_grovefinds the nearest biome of that type. - Java:
/seedshows the world seed so you can share or reuse the world.
Keep Inventory and Other Gamerules
Gamerules change how the world behaves. Java Edition renamed its gamerules in version 1.21.11 (December 2025) from names like keepInventory to lowercase names with underscores. Use the new names in Java 26.x:
- Java:
/gamerule keep_inventory true. Bedrock:/gamerule keepinventory true. You keep your items and experience when you die. - Java:
/gamerule advance_time false. Bedrock:/gamerule dodaylightcycle false. Stops the day and night cycle. - Java:
/gamerule advance_weather false. Bedrock:/gamerule doweathercycle false. Stops weather changes. - Java:
/gamerule spawn_phantoms false. Bedrock:/gamerule doinsomnia false. No more phantoms when you skip sleep. - Bedrock only:
/gamerule showcoordinates trueshows your coordinates on screen. On Java PC, press F3 instead.
Building Helpers
/fill ~ ~ ~ ~10 ~5 ~10 stonefills a box with stone, starting where you stand. The tilde (~) means “my current position”./fill ~-5 ~ ~-5 ~5 ~5 ~5 airclears a space around you./kill @e[type=zombie]removes every zombie that is loaded. Never run/kill @eon its own, because it also removes your pets and items.
Tips for Using Commands Safely
- Make a copy of your world before running big
/fillor/killcommands. - Press the Up arrow in Java chat to repeat your last command.
- Press Tab in Java to auto complete item and block names.
- If a command fails, check the edition: many Java and Bedrock commands look similar but use different words.
Learning the basics first? Our first night survival guide walks you through day one without any commands.
Frequently Asked Questions
Do commands disable achievements?
In Bedrock Edition, turning on cheats disables achievements for that world permanently. Java Edition advancements still work with commands on.
Why does /gamerule keepInventory not work in Java anymore?
Java 1.21.11 renamed gamerules. Use /gamerule keep_inventory true in current Java versions.
Can I use commands on a Realm?
Yes, if the Realm owner turns on cheats or gives you operator permission.
How do I find my coordinates?
On Java PC press F3. On Bedrock, turn on Show Coordinates in the world settings or use /gamerule showcoordinates true.
Last updated: October 18, 2026
Leave a Reply