Minecraft cheat codes: 36 useful cheats and commands
A complete list of the most important Minecraft codes, commands and cheats. Each code comes with the exact syntax for Java and Bedrock Edition, an explanation of what it does, practical tips and related commands. Here you'll find ready-to-type commands for invincibility, unlimited diamonds, teleporting, changing the time of day and much more.
How to enable cheats in Minecraft
To use codes (commands) in Minecraft, you need cheats turned on in the world settings. Here's how to do it in each edition:
Java Edition
- When you create a world, turn on "Allow Commands" (called "Allow Cheats" in older versions)
- In an existing world: press Esc, click "Open to LAN" and turn on "Allow Commands"
- To type a command, press T (chat) or /
Bedrock Edition
- When you create a world, turn on "Activate Cheats" in the settings
- In an existing world: open Settings, go to "Game" and turn on "Cheats"
- Note: turning on cheats disables achievements in that world!
- Type commands by opening chat and starting with /
Detailed guide: How to enable cheats in Minecraft
Most popular cheats
Invincibility (god mode)
Turn on god mode with the /gamemode creative command or the Resistance effect.
/gamemode creative Diamonds and resources
Give yourself diamonds, netherite, emeralds and other valuable resources with one command.
/give @s minecraft:diamond 64 Teleport to coordinates
Move to any place on the map by entering its X, Y and Z coordinates.
/tp @s 0 64 0 Set day
Switch to daytime with the /time set day command and get rid of the night.
/time set day Creative mode
Switch to Creative mode: unlimited blocks, flying and no damage.
/gamemode creative Keep inventory after death
Turn on keepInventory so you don't lose your items and XP when you die.
/gamerule keepInventory true Unlimited items
Give yourself any number of items with the /give command and its amount parameter.
/give @s minecraft:diamond 64 Flying
Fly in Survival mode with the /ability command, or switch to Creative mode to fly.
/gamemode creative Survival
4 codesInvincibility (god mode)
Java & BedrockTurn on god mode with the /gamemode creative command or the Resistance effect.
/gamemode creative Unlimited items
Java & BedrockGive yourself any number of items with the /give command and its amount parameter.
/give @s minecraft:diamond 64 Flying
Java & BedrockFly in Survival mode with the /ability command, or switch to Creative mode to fly.
/gamemode creative Full health and hunger
Java & BedrockHeal instantly and fill your hunger bar with status effects.
/effect give @s minecraft:instant_health 1 255 Items
4 codesDiamonds and resources
Java & BedrockGive yourself diamonds, netherite, emeralds and other valuable resources with one command.
/give @s minecraft:diamond 64 Enchanted items
Java & BedrockCreate items with any enchantments and levels using /give with NBT data.
/enchant @s minecraft:sharpness 5 Netherite armor and tools
Java & BedrockGive yourself a full set of netherite gear with /give.
/give @s minecraft:netherite_helmet 1 Special items
Java & BedrockGet unique items: the enchanted golden apple, the trident, the mace and more.
/give @s minecraft:enchanted_golden_apple 64 Teleportation
3 codesTeleport to coordinates
Java & BedrockMove to any place on the map by entering its X, Y and Z coordinates.
/tp @s 0 64 0 Teleport to a player
Java & BedrockTeleport to another player or bring a player to you.
/tp @s PlayerName Teleport to spawn
Java & BedrockGet back to the world spawn point or to your bed.
/spawnpoint @s Time and weather
4 codesSet day
Java & BedrockSwitch to daytime with the /time set day command and get rid of the night.
/time set day Set night
Java & BedrockSwitch to nighttime: perfect for farming mobs and looking for phantoms.
/time set night Turn off rain and snow
Java & BedrockStop rain, thunderstorms and snow with the /weather clear command.
/weather clear Freeze time
Java & BedrockStop the day/night cycle and the weather for good with game rules.
/gamerule doDaylightCycle false Game modes
4 codesCreative mode
Java & BedrockSwitch to Creative mode: unlimited blocks, flying and no damage.
/gamemode creative Survival mode
Java & BedrockGo back to Survival mode: gathering resources, hunger and fighting mobs.
/gamemode survival Adventure mode
Java & BedrockYou can't break or place blocks without the right tools.
/gamemode adventure Spectator mode
JavaFly through blocks and watch other players while staying invisible.
/gamemode spectator Mobs
3 codesSummon mobs
Java & BedrockSummon any mob with the /summon command, from a creeper to the Ender Dragon.
/summon minecraft:zombie ~ ~ ~ Kill mobs
Java & BedrockRemove all the mobs around you with the /kill command: a quick way to clear an area.
/kill @e[type=!player] Summon a boss
Java & BedrockSummon the Ender Dragon, the Wither or the Warden with the /summon command.
/summon minecraft:ender_dragon ~ ~ ~ World
4 codesWorld seed
Java & BedrockCheck the seed of your current world with the /seed command.
/seed Find a structure
Java & BedrockLocate a village, a stronghold, an ocean monument and other structures with the /locate command.
/locate structure minecraft:village_plains Fill blocks
Java & BedrockFill huge areas with blocks or clear the ground with the /fill command.
/fill ~-10 ~-1 ~-10 ~10 ~-1 ~10 minecraft:stone Clone builds
Java & BedrockCopy builds from one place to another with the /clone command.
/clone ~-10 ~-1 ~-10 ~10 ~10 ~10 ~20 ~-1 ~-10 Player
4 codesExperience (XP)
Java & BedrockGive yourself experience points or XP levels with the /xp or /experience command.
/xp add @s 30 levels Status effects
Java & BedrockGive yourself any effect: Speed, Strength, Invisibility and more.
/effect give @s minecraft:speed 999999 2 true Change the difficulty
Java & BedrockSwitch between Peaceful, Easy, Normal and Hard with the /difficulty command.
/difficulty peaceful Keep inventory after death
Java & BedrockTurn on keepInventory so you don't lose your items and XP when you die.
/gamerule keepInventory true Advanced
3 codesWorld border
Java & BedrockSet the world border with /worldborder and control the size of the map.
/worldborder set 1000 Game rules (gamerule)
Java & BedrockChange the fundamental rules of the game, from creeper explosions to how recipes are shown.
/gamerule mobGriefing false Scoreboard
Java & BedrockCreate scoreboards, counters and point systems with the /scoreboard command.
/scoreboard objectives add Points dummy Bedrock
3 codes/ability (Bedrock)
BedrockGrant players permissions in Bedrock Edition: flying, building, mining.
/ability @s mayfly true /camera (Bedrock)
BedrockControl the player's camera in Bedrock: create cutscenes and cinematic effects.
/camera @s set minecraft:free pos 0 100 0 rot 0 90 /dialogue (Bedrock)
BedrockCreate interactive NPC dialogue in Bedrock Edition: quests and conversations.
/dialogue open @e[type=npc,c=1] @s Frequently asked questions
Do cheats disable achievements?
In Bedrock Edition, yes: turning on cheats permanently disables achievements in that world. In Java Edition, no: advancements work whether cheats are on or not.
Can I use cheats on a multiplayer server?
On a server you need operator (OP) status or the right permissions granted by plugins (for example LuckPerms). Regular players can't use most commands by default. On Realms, the owner can grant permissions in the settings.
What's the difference between Java and Bedrock commands?
The main differences: Bedrock has exclusive commands such as /ability, /camera and /dialogue, while Java has spectator mode and more game rules. Selectors (@p, @a, @r, @e, @s) work the same way in both editions.
How do I undo a command?
It depends on the command: /effect clear @s removes status effects. /gamemode survival puts you back in Survival mode. /gamerule keepInventory false turns keep inventory off. /weather clear clears the weather. For bigger mistakes (for example with /fill) there's no built-in "undo", but on servers the CoreProtect plugin lets you roll changes back.
Do cheats work in Minecraft on a phone?
Yes. Minecraft on phones (iOS and Android) is Bedrock Edition, so every command marked "Bedrock" or "Java & Bedrock" works on a phone. Just turn on cheats in the world settings and open chat with the speech bubble icon. Commands exclusive to Java Edition don't work on phones.
Related guides
Minecraft commands
A complete list of every command with its full syntax
How to enable cheats
A detailed step-by-step guide to turning on cheats
/give generator
An interactive /give command generator with NBT
/summon generator
An interactive /summon command generator with NBT data
/effect generator
An interactive generator for status effect commands
Minecraft enchantments
A guide to every enchantment in the game
How to redeem a code at minecraft.net/redeem
Where to enter a code to claim the game or a cape: the steps, common errors and how to avoid scams