The Minecraft commands you actually need
The 15 commands worth knowing in Java Edition 26.3, from /gamemode and /gamerule keep_inventory to /locate, /fill and safe item cleanup.

On this page · 6
About fifteen commands cover nearly everything you will do with cheats: switching modes, fixing time and weather, getting gear and finding structures. Every line below was checked against Java Edition 26.3, where game rules now use snake_case names.
Turn on cheats
All commands on this page need operator permission (only /seed works without it in singleplayer).
- New world: Create New World, Game tab, Allow Cheats ON.
- Existing world: Esc, World Options..., Allow Cheats ON, Apply Changes. In 26.3 this button replaced "Open to LAN" in the Game Menu.
- Server: ask the owner to make you an operator.
Open the chat with T or /. While you type, the game suggests arguments and Tab completes them. Test a command in the builder below before you paste it.
Command generator
Fill in the fields, copy the command, paste it in the chat. Syntax checked against Java Edition 26.3.
Turn on JavaScript to use the interactive version.
/give @p diamond 64Calculated from the Java Edition 26.3 game files
Change the game mode, time and weather
/gamemode creative
/gamemode survival Steve
/time set day
/weather clear
/difficulty peaceful
/gamemodetakessurvival,creative,adventureorspectator, optionally followed by a player./time setacceptsday(1000),noon(6000),night(13000),midnight(18000) or a number of ticks. The Nether has no clock of its own: there, use/time of minecraft:overworld set day./weathertakesclear,rainorthunder, plus an optional duration such as1d(one in-game day)./difficultytakespeaceful,easy,normalorhard.
Set the game rules
Game rules are switches for the whole world. Since 26.x they are written in snake_case: keepInventory no longer works.
/gamerule keep_inventory true
/gamerule advance_time false
/gamerule advance_weather false
/gamerule mob_griefing false
In order: keep items and XP on death, freeze the day-night cycle, stop weather changes, stop creepers and endermen from changing blocks. Type a rule without a value (/gamerule keep_inventory) to see its current setting. The same switches are in World Options under Edit Game Rules....
Get items, effects and enchantments
/give @s minecraft:diamond_pickaxe
/give @s minecraft:torch 64
/effect give @s minecraft:night_vision infinite 0 true
/effect clear @s
/enchant @s minecraft:efficiency 5
/giveputs an item in your inventory, the number at the end is the amount./effect givetakes seconds orinfinite, then the amplifier (0 = level I) andtrueto hide particles. The example gives permanent Night Vision./enchantworks on the item in your main hand, only up to the normal maximum level and only if the item accepts the enchantment. Efficiency stops at V, Sharpness at V, Unbreaking at III.
Find places and set your spawn
/locate structure #minecraft:village
/locate biome minecraft:cherry_grove
/tp 250 80 -1200
/seed
/spawnpoint
/setworldspawn
/locatereturns the nearest structure or biome. Click the coordinates in the chat and the game prepares a/tp @scommand for you./tp X Y Ztakes you there./seedshows the world seed. In singleplayer it works even without cheats./spawnpointsets your respawn point where you stand./setworldspawnmoves the world spawn for everyone, in the dimension where you run it.
Spawn mobs, edit blocks and clean up
/summon minecraft:iron_golem
/summon minecraft:lightning_bolt ~ ~ ~5
/fill ~-3 ~ ~-3 ~3 ~2 ~3 minecraft:air
/kill @e[type=minecraft:item]
/summonspawns an entity at your feet or at the given position. The second line strikes lightning 5 blocks south of you./fillreplaces a box between two corners. The example clears a 7 × 3 × 7 space around you (147 blocks). One command can change at most 32,768 blocks by default (game rulemax_block_modifications)./kill @e[type=minecraft:item]removes every dropped item in loaded chunks, handy after a farm or a/fillwithdestroy.
Never run/killor/kill @ewithout a filter: the first kills you, the second kills every mob and every player, you included. There is no undo for/killor/fill.
FAQ
Do cheats disable advancements in Java Edition?
No. In Java Edition you still earn advancements with cheats on. Only Bedrock Edition disables achievements in a world once cheats have been used.
How do I turn cheats off again?
Open World Options from the Game Menu, set Allow Cheats to OFF and click Apply Changes. Commands then stop working for you in that world.
Can I undo a /fill or /kill command?
No, vanilla Minecraft has no undo. Copy your world folder before large /fill operations so you can go back if something goes wrong.