Discord
Guide

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.

36 codes and commands
10 categories
2 game editions

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

  1. When you create a world, turn on "Allow Commands" (called "Allow Cheats" in older versions)
  2. In an existing world: press Esc, click "Open to LAN" and turn on "Allow Commands"
  3. To type a command, press T (chat) or /

Bedrock Edition

  1. When you create a world, turn on "Activate Cheats" in the settings
  2. In an existing world: open Settings, go to "Game" and turn on "Cheats"
  3. Note: turning on cheats disables achievements in that world!
  4. Type commands by opening chat and starting with /

Detailed guide: How to enable cheats in Minecraft

Most popular cheats

Survival Java & Bedrock

Invincibility (god mode)

Turn on god mode with the /gamemode creative command or the Resistance effect.

/gamemode creative
Items Java & Bedrock

Diamonds and resources

Give yourself diamonds, netherite, emeralds and other valuable resources with one command.

/give @s minecraft:diamond 64
Teleportation Java & Bedrock

Teleport to coordinates

Move to any place on the map by entering its X, Y and Z coordinates.

/tp @s 0 64 0
Time and weather Java & Bedrock

Set day

Switch to daytime with the /time set day command and get rid of the night.

/time set day
Game modes Java & Bedrock

Creative mode

Switch to Creative mode: unlimited blocks, flying and no damage.

/gamemode creative
Player Java & Bedrock

Keep inventory after death

Turn on keepInventory so you don't lose your items and XP when you die.

/gamerule keepInventory true
Survival Java & Bedrock

Unlimited items

Give yourself any number of items with the /give command and its amount parameter.

/give @s minecraft:diamond 64
Survival Java & Bedrock

Flying

Fly in Survival mode with the /ability command, or switch to Creative mode to fly.

/gamemode creative

Survival

4 codes

Invincibility (god mode)

Java & Bedrock

Turn on god mode with the /gamemode creative command or the Resistance effect.

/gamemode creative
→

Unlimited items

Java & Bedrock

Give yourself any number of items with the /give command and its amount parameter.

/give @s minecraft:diamond 64
→

Flying

Java & Bedrock

Fly in Survival mode with the /ability command, or switch to Creative mode to fly.

/gamemode creative
→

Full health and hunger

Java & Bedrock

Heal instantly and fill your hunger bar with status effects.

/effect give @s minecraft:instant_health 1 255
→

Items

4 codes

Diamonds and resources

Java & Bedrock

Give yourself diamonds, netherite, emeralds and other valuable resources with one command.

/give @s minecraft:diamond 64
→

Enchanted items

Java & Bedrock

Create items with any enchantments and levels using /give with NBT data.

/enchant @s minecraft:sharpness 5
→

Netherite armor and tools

Java & Bedrock

Give yourself a full set of netherite gear with /give.

/give @s minecraft:netherite_helmet 1
→

Special items

Java & Bedrock

Get unique items: the enchanted golden apple, the trident, the mace and more.

/give @s minecraft:enchanted_golden_apple 64
→

Teleportation

3 codes

Teleport to coordinates

Java & Bedrock

Move to any place on the map by entering its X, Y and Z coordinates.

/tp @s 0 64 0
→

Teleport to a player

Java & Bedrock

Teleport to another player or bring a player to you.

/tp @s PlayerName
→

Teleport to spawn

Java & Bedrock

Get back to the world spawn point or to your bed.

/spawnpoint @s
→

Time and weather

4 codes

Set day

Java & Bedrock

Switch to daytime with the /time set day command and get rid of the night.

/time set day
→

Set night

Java & Bedrock

Switch to nighttime: perfect for farming mobs and looking for phantoms.

/time set night
→

Turn off rain and snow

Java & Bedrock

Stop rain, thunderstorms and snow with the /weather clear command.

/weather clear
→

Freeze time

Java & Bedrock

Stop the day/night cycle and the weather for good with game rules.

/gamerule doDaylightCycle false
→

Game modes

4 codes

Creative mode

Java & Bedrock

Switch to Creative mode: unlimited blocks, flying and no damage.

/gamemode creative
→

Survival mode

Java & Bedrock

Go back to Survival mode: gathering resources, hunger and fighting mobs.

/gamemode survival
→

Adventure mode

Java & Bedrock

You can't break or place blocks without the right tools.

/gamemode adventure
→

Spectator mode

Java

Fly through blocks and watch other players while staying invisible.

/gamemode spectator
→

Mobs

3 codes

Summon mobs

Java & Bedrock

Summon any mob with the /summon command, from a creeper to the Ender Dragon.

/summon minecraft:zombie ~ ~ ~
→

Kill mobs

Java & Bedrock

Remove all the mobs around you with the /kill command: a quick way to clear an area.

/kill @e[type=!player]
→

Summon a boss

Java & Bedrock

Summon the Ender Dragon, the Wither or the Warden with the /summon command.

/summon minecraft:ender_dragon ~ ~ ~
→

World

4 codes

World seed

Java & Bedrock

Check the seed of your current world with the /seed command.

/seed
→

Find a structure

Java & Bedrock

Locate a village, a stronghold, an ocean monument and other structures with the /locate command.

/locate structure minecraft:village_plains
→

Fill blocks

Java & Bedrock

Fill huge areas with blocks or clear the ground with the /fill command.

/fill ~-10 ~-1 ~-10 ~10 ~-1 ~10 minecraft:stone
→

Clone builds

Java & Bedrock

Copy builds from one place to another with the /clone command.

/clone ~-10 ~-1 ~-10 ~10 ~10 ~10 ~20 ~-1 ~-10
→

Player

4 codes

Experience (XP)

Java & Bedrock

Give yourself experience points or XP levels with the /xp or /experience command.

/xp add @s 30 levels
→

Status effects

Java & Bedrock

Give yourself any effect: Speed, Strength, Invisibility and more.

/effect give @s minecraft:speed 999999 2 true
→

Change the difficulty

Java & Bedrock

Switch between Peaceful, Easy, Normal and Hard with the /difficulty command.

/difficulty peaceful
→

Keep inventory after death

Java & Bedrock

Turn on keepInventory so you don't lose your items and XP when you die.

/gamerule keepInventory true
→

Advanced

3 codes

World border

Java & Bedrock

Set the world border with /worldborder and control the size of the map.

/worldborder set 1000
→

Game rules (gamerule)

Java & Bedrock

Change the fundamental rules of the game, from creeper explosions to how recipes are shown.

/gamerule mobGriefing false
→

Scoreboard

Java & Bedrock

Create scoreboards, counters and point systems with the /scoreboard command.

/scoreboard objectives add Points dummy
→

Bedrock

3 codes

/ability (Bedrock)

Bedrock

Grant players permissions in Bedrock Edition: flying, building, mining.

/ability @s mayfly true
→

/camera (Bedrock)

Bedrock

Control 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)

Bedrock

Create 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