Minecraft: Java Edition

Cheats & codes

Minecraft: Java Edition Cheat Codes

Grouped by type and platform, each one labelled reported working or tested.

There are 20 cheat codes for Minecraft: Java Edition across PC (Microsoft Windows). Each code below lists the exact button combination or console command, what it does, and whether using it disables achievements.

Verified

Console commands

20

Clear Weather

Clears rain and storms.

Press T to open chat, type the command, press Enter.

PC Reported working
Did this work for you?

Requires cheats enabled. Options: clear, rain, thunder.

Creative Mode Switch

Switches your game mode to Creative.

Press T to open chat, type the command, press Enter.

PC Reported working
Did this work for you?

Requires cheats enabled (Allow Cheats when creating the world, or Open to LAN → Allow Cheats).

Fill With Diamond Blocks

Fills a 10×10×10 area with diamond blocks.

Stand somewhere, press T, type the command, press Enter.

PC Reported working
Did this work for you?

Requires cheats enabled. Use minecraft:air to excavate.

Free XP Levels

Gives you 100 experience levels.

Press T to open chat, type the command, press Enter.

PC Reported working
Did this work for you?

Requires cheats enabled. Omit "levels" to add XP points instead.

Give Diamonds

Gives you 64 diamonds.

Press T to open chat, type the command, press Enter.

PC Reported working
Did this work for you?

Requires cheats enabled. Item IDs follow the minecraft: namespace.

Keep Inventory on Death

You keep your items when you die.

Press T to open chat, type the command, press Enter.

PC Reported working
Did this work for you?

Requires cheats enabled. Persists for the world.

Kill Yourself

Kills your character (respawn as normal).

Press T to open chat, type the command, press Enter.

PC Reported working
Did this work for you?

Requires cheats enabled. Without @s it can kill nearby entities.

Locate Structure

Prints the coordinates of the nearest stronghold.

Press T to open chat, type the command, press Enter, then /tp to the coordinates.

PC Reported working
Did this work for you?

Requires cheats enabled. Current syntax uses "structure" or "biome" as category.

Peaceful Difficulty

Sets difficulty to peaceful (no hostile mobs).

Press T to open chat, type the command, press Enter.

PC Reported working
Did this work for you?

Requires cheats enabled. Options: peaceful, easy, normal, hard.

Summon Mob

Summons a creeper at your position.

Press T to open chat, type the command, press Enter.

PC Reported working
Did this work for you?

Requires cheats enabled. Works with any valid entity ID.

Switch to Creative mode

Infinite blocks, flight and invulnerability.

Press T to open chat, type the command, press Enter. Cheats must be enabled for the world.

PC Reported working
Did this work for you?

Enabling cheats disables achievements in that world on Bedrock Edition.

Teleport

Teleports you to coordinates X=0, Y=100, Z=0.

Press T to open chat, type the command, press Enter.

PC Reported working
Did this work for you?

Requires cheats enabled. Use ~ for relative coordinates.

Unbreakable Tool

Applies Unbreaking to the item you are holding.

Hold an enchantable item, press T, type the command, press Enter.

PC Reported working
Did this work for you?

Requires cheats enabled. Only works on enchantable held items.

Set Time to Day

Sets the world time to daytime.

Press T to open chat, type the command, press Enter.

PC Reported working
Did this work for you?

Requires cheats enabled. Use night, or tick values 0–24000.

Clear the weather

Stops rain and thunderstorms.

PC Reported working
Did this work for you?

Give yourself any item

Gives 64 diamonds to the nearest player.

Replace "diamond" with any item id and 64 with the quantity.

PC Reported working
Did this work for you?

Keep your items on death

You no longer drop your inventory when you die.

PC Reported working
Did this work for you?

Night Vision

Gives night vision for 10 minutes (600 seconds).

Press T to open chat, type the command, press Enter.

PC Reported working
Did this work for you?

Requires cheats enabled. Use /effect clear @s to remove all effects.

Stop the day/night cycle

Freezes time at its current point.

PC Reported working
Did this work for you?

Find a structure

Reports the coordinates of the nearest village.

Swap "village" for stronghold, fortress, ancient_city and so on.

PC Reported working
Did this work for you?
A code stopped working after a patch? Tell us and we will retest it. Know one we are missing? Submit it here. What the tested badge means, and which codes carry it.

Tools for Minecraft: Java Edition cheats

Quick answers

About Minecraft: Java Edition cheats

How many cheats does Minecraft: Java Edition have?
This page lists 20 for Minecraft: Java Edition, all of them console commands.
How do you enter cheats in Minecraft: Java Edition?
Press T to open chat, type the command, press Enter. A few codes use a different method, shown beside each one.
Do cheats disable achievements in Minecraft: Java Edition?
1 of the 20 codes here carry a warning about achievements or trophies. The note reads: "Enabling cheats disables achievements in that world on Bedrock Edition."
Which platforms are these Minecraft: Java Edition cheats for?
The codes on this page are listed for PC (20 codes). Where the game came out on other systems, the codes may differ there.
Are these Minecraft: Java Edition cheats still working?
All 20 are marked "Reported working": each comes from a documented source, and none has been run by us yet. A code we test gets a dated "Tested" badge.