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.
Console commands
20Clear Weather
Clears rain and storms.
Press T to open chat, type the command, press Enter.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Requires cheats enabled. Use night, or tick values 0–24000.
Clear the weather
Stops rain and thunderstorms.
Give yourself any item
Gives 64 diamonds to the nearest player.
Replace "diamond" with any item id and 64 with the quantity.
Keep your items on death
You no longer drop your inventory when you die.
Night Vision
Gives night vision for 10 minutes (600 seconds).
Press T to open chat, type the command, press Enter.
Requires cheats enabled. Use /effect clear @s to remove all effects.
Stop the day/night cycle
Freezes time at its current point.
Find a structure
Reports the coordinates of the nearest village.
Swap "village" for stronghold, fortress, ancient_city and so on.
Tools for Minecraft: Java Edition cheats
-
Why is my cheat not working?
Answer a few questions and get the specific reason, from our guides.
-
Search Minecraft: Java Edition codes by effect
Type "money" or "god mode" and find the code, typos forgiven.
-
Build a console command for Minecraft: Java Edition
Change the amount, item or location and copy a checked line.
-
Test your controller and button sequences
See every button respond, and check a sequence press by press.
Quick answers