What people call Minecraft "cheat codes" are really commands: short lines typed into chat, starting with a forward slash (/). Switching game modes, keeping it daytime, holding on to your items when you die or finding the nearest village each takes a single line. The only catch is writing the command the way your edition expects it.
Minecraft on Xbox, PlayStation, Nintendo Switch, Android, iOS and Windows is Bedrock Edition. The classic PC version, available on Windows, macOS and Linux, is Java Edition. On Windows the same Minecraft Launcher starts both editions, so check which one you are running. Most commands share the same name on both, but some are written differently, so where they differ, the table below lists the Bedrock and Java versions separately. Java syntax follows Java 26.3, released in September 2026.
How to turn on cheats
Bedrock: consoles, mobile and Windows
Turn on the Cheats option when you create a world, or later by editing an existing world's settings.
Warning: on Bedrock, enabling cheats permanently disables achievements for that world, even if you turn cheats off again afterwards. If you are hunting achievements, experiment in a separate world.
Java Edition (PC)
- New world: switch on Allow Commands on the world creation screen.
- Existing world (26.2 and later): press Esc, open World Options and switch on Allow Commands. The option is not available in Hardcore worlds.
- Older Java versions: press Esc, choose Open to LAN, set Allow Cheats to on and start the LAN world. This only enables commands for that session.
On a server or a Realm, the world setting alone is not enough: you need operator permission. As the owner of a Realm you have it by default, but on a server you host yourself it is not automatic: give it to yourself by typing op PlayerName in the server console.
How to enter a command
- Open chat. On a keyboard, press T. In Java, the
/key also opens chat with the slash already typed. On consoles, use the controller's chat button; on phones and tablets, tap the chat icon on screen. - Start with
/. Without the slash, the text is sent as a normal chat message. As you type, the game suggests matching commands, and on a keyboard Tab completes the highlighted option. - Send it. If something is wrong, the command does not run and the game shows an error. With chat open, the up arrow key brings back your previous commands.
Most used Minecraft commands
@s targets you, @a all players, @p the nearest player and @e every entity, including animals and dropped items.
| Command | What it does |
|---|---|
/gamemode creative | Switches you to Creative. Use survival to go back. |
/difficulty peaceful | Most hostile mobs vanish and stop spawning, and your health regenerates quickly on its own. A few exceptions such as shulkers and the Ender Dragon remain, and falling or drowning can still kill you. |
Bedrock: /gamerule keepinventory trueJava: /gamerule keep_inventory true | You keep your items when you die instead of dropping them. Use false to turn it off. |
/tp 100 70 -200 | Teleports you to those coordinates. /tp ~ ~10 ~ moves you 10 blocks straight up. |
/tp PlayerName | Teleports you to that player. |
/tp PlayerName 100 70 -200 | Teleports the named player, not you, to the coordinates. |
/give @s diamond 64 | Gives you 64 diamonds. Items are written with their English IDs. |
Bedrock: /locate structure villageJava: /locate structure #village | Shows the coordinates of the nearest village. Java treats villages as a tag, hence the #. stronghold, ancient_city and trial_chambers are written the same way in both editions. |
/time set day | Sets the time to morning. Use night for nighttime. |
Bedrock: /gamerule dodaylightcycle falseJava: /gamerule advance_time false | Stops the day-night cycle so the time stays fixed. |
/weather clear | Clears the sky. rain brings rain, thunder a storm. |
/summon wolf | Spawns a wolf where you stand. |
Bedrock: /effect @s night_vision 600Java: /effect give @s night_vision 600 | Night vision for 600 seconds (10 minutes). Use infinite instead of a number for no time limit. |
Bedrock: /effect @s clearJava: /effect clear @s | Removes all your active effects. |
/kill @e[type=item] | Removes only items lying on the ground. |
Bedrock: /xp 100 @sJava: /xp add @s 100 | Gives you 100 experience points. In Java, add levels at the end to give levels instead. |
/enchant @s sharpness 5 | Adds Sharpness V to the sword in your hand. Fails on items that cannot take the enchantment or above the maximum level. |
/spawnpoint | Moves your spawn point to where you are standing. |
/clear @s dirt | Removes only dirt from your inventory. Leave out the item and your whole inventory is wiped. |
Bedrock: /gamerule showcoordinates trueJava: None | Keeps your coordinates on screen at all times. This rule exists only on Bedrock. |
Be careful with /kill: the often-suggested /kill @e[type=!player] does not just clear out monsters. Your pets, villagers, item frames, armor stands and dropped items go too. If you only want to clean up items on the ground, /kill @e[type=item] is enough. And /kill with no target kills you.
Old syntax that no longer works
Some commands from older guides now throw errors. In most cases the command did not go away; only the way you write it changed:
/gamemode 1and/gamemode 0: Java dropped numeric game modes in 1.13 (2018), so you needcreativeorsurvival. On Bedrock the numbers still work: 0 is Survival, 1 Creative, 2 Adventure./give @s 264: numeric item IDs also disappeared from Java in 1.13, and Bedrock's current command documentation identifies items by name too. Typediamondin both editions./toggledownfall: removed from Java in 1.13; use/weather clearor/weather raininstead. On Bedrock it still exists and toggles precipitation.- Old game rule names such as
keepInventoryanddoDaylightCycle: Java 1.21.11 (December 9, 2025) moved every game rule to lowercase names with underscores, and some got entirely new names:doDaylightCycleis nowadvance_timeanddoMobSpawningisspawn_mobs. The old names return an error in Java. Bedrock's names (keepinventory,dodaylightcycle) have not changed. /effectwithoutgivein Java:/effect @s speed 60works on Bedrock but fails in Java, where effects are applied with/effect giveand removed with/effect clear.- Curly-brace NBT in
/give: since Java 1.20.5 (April 2024), item data is written as item components in square brackets instead of{...}. For example,/give @s stick{foo:'bar'}is now/give @s stick[custom_data={foo:'bar'}].
Command not working? Check these
- Are cheats on? Check the Cheats option in the world settings on Bedrock, or Allow Commands in Java.
- Do you have permission? On a server or Realm you need operator status, and on a server you host yourself you have to give it to yourself first. On Bedrock, the "Operator Commands" permission, found in the player permissions menu next to your name in the pause menu, must also be on.
- Are you using the right edition's syntax? Java syntax (
keep_inventory,/effect give) fails on consoles, and Bedrock syntax fails in Java on PC. - Any typos? Commands use English IDs. A missing space or a wrong bracket breaks the whole command, so follow the suggestion list as you type.
- Is the game up to date? Some syntax only exists from a certain version on. The
infiniteeffect duration, for example, arrived in Java 1.19.4, and enabling commands from World Options came with Java 26.2.
If you forget how a command is written, type /help followed by the command name. For the full reference, see the Microsoft Learn commands guide for Bedrock and the Minecraft Wiki commands page for Java.