News
Game
Guides
Downloads
Versions
Commands · Tutorial

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.

Beginner 3 min read Updated Tested on Java 26.3
An orange command block surrounded by stone cubes arranged in a tidy grid.
On this page · 6
  1. Turn on cheats
  2. Change the game mode, time and weather
  3. Set the game rules
  4. Get items, effects and enchantments
  5. Find places and set your spawn
  6. Spawn mobs, edit blocks and clean up

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.

Interactive tool

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 64

Calculated 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
  • /gamemode takes survival, creative, adventure or spectator, optionally followed by a player.
  • /time set accepts day (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.
  • /weather takes clear, rain or thunder, plus an optional duration such as 1d (one in-game day).
  • /difficulty takes peaceful, easy, normal or hard.

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
  • /give puts an item in your inventory, the number at the end is the amount.
  • /effect give takes seconds or infinite, then the amplifier (0 = level I) and true to hide particles. The example gives permanent Night Vision.
  • /enchant works 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
  • /locate returns the nearest structure or biome. Click the coordinates in the chat and the game prepares a /tp @s command for you.
  • /tp X Y Z takes you there.
  • /seed shows the world seed. In singleplayer it works even without cheats.
  • /spawnpoint sets your respawn point where you stand. /setworldspawn moves 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]
  • /summon spawns an entity at your feet or at the given position. The second line strikes lightning 5 blocks south of you.
  • /fill replaces 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 rule max_block_modifications).
  • /kill @e[type=minecraft:item] removes every dropped item in loaded chunks, handy after a farm or a /fill with destroy.
Never run /kill or /kill @e without a filter: the first kills you, the second kills every mob and every player, you included. There is no undo for /kill or /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.