MineToolsminetools.cn · Minecraft Java Tools

Minecraft Command List

Minecraft command list with one-click copying: keep inventory after dying, Creative Mode, permanent daytime, clear weather, no explosions, teleporting, getting a Command Block, max-level enchantments, permanent Night Vision, invincibility, and more. Automatically uses the correct syntax for the selected version (1.14–26.3).

Commands below use the Minecraft Java 26.3 syntax for Minecraft Java {label} (switch versions in the top-right corner). Click “Copy” and paste it into Chat or a command block.

Useful Survival Commands

Keep Inventory on Death

All Game Rules ›
/gamerule keep_inventory true

Keep your inventory and experience when you die. Set this to false to disable it.

1.21.10 and earlier:/gamerule keepInventory true

Creative Mode Command

/gamemode creative

Survival Mode is survival, Adventure Mode is adventure, and Spectator Mode is spectator.

Survival Mode Command

/gamemode survival

Daytime Forever Command

/time set day/gamerule advance_time false

The first command sets the time to day; the second stops time from advancing.

1.21.10 and earlier:/time set day /gamerule doDaylightCycle false

Clear Weather Forever Command (Stop Rain)

/weather clear/gamerule advance_weather false
1.21.10 and earlier:/weather clear /gamerule doWeatherCycle false

Disable Creeper Explosions (Creepers Won't Damage Blocks)

/gamerule mob_griefing false

When disabled, mobs can't break blocks, and villagers can't harvest crops. TNT will still explode.

1.21.10 and earlier:/gamerule mobGriefing false

Peaceful Difficulty Command

/difficulty peaceful

Other difficulties: easy, normal, and hard.

Respawn Immediately After Dying

/gamerule immediate_respawn true
1.15 ~ 1.21.10:/gamerule doImmediateRespawn true

Skip the Night When One Player Sleeps

/gamerule players_sleeping_percentage 0
1.17 ~ 1.21.10:/gamerule playersSleepingPercentage 0

Disable Natural Mob Spawning

/gamerule spawn_mobs false
1.21.10 and earlier:/gamerule doMobSpawning false

Set Your Own Spawn Point

/spawnpoint @s ~ ~ ~

Use /setworldspawn to set the world spawn point.

Suicide Command

/kill @s

Teleport Commands

Teleport to Coordinates

Teleport Command Generator ›
/tp @s 0 100 0

Teleport to a Player

/tp @s Steve

Replace Steve with a player's name.

Teleport All Players to You

/tp @a @s

Teleport to the Nether

/execute in the_nether run tp @s 0 70 0

Teleport to The End

/execute in the_end run tp @s 100 50 0

Return to the Overworld

/execute in overworld run tp @s 0 100 0

Give Item Commands

Get a Command Block

Blocks with Data ›
/give @s command_block

On a server, you also need to set enable-command-block=true in server.properties.

A Stack of Diamonds

/give @s diamond 64

Fully Enchanted Diamond Sword

Item Generator ›
/give @s diamond_sword[enchantments={sharpness:5,looting:3,fire_aspect:2,knockback:2,unbreaking:3,mending:1}]
1.20.5 ~ 1.21.4:/give @s diamond_sword[enchantments={levels:{sharpness:5,looting:3,fire_aspect:2,knockback:2,unbreaking:3,mending:1}}]
1.20.4 and earlier:/give @s diamond_sword{Enchantments:[{id:"minecraft:sharpness",lvl:5s},{id:"minecraft:looting",lvl:3s},{id:"minecraft:fire_aspect",lvl:2s},{id:"minecraft:knockback",lvl:2s},{id:"minecraft:unbreaking",lvl:3s},{id:"minecraft:mending",lvl:1s}]}

Fully Enchanted Netherite Pickaxe

All Enchantment Commands ›
/give @s netherite_pickaxe[enchantments={efficiency:5,fortune:3,unbreaking:3,mending:1}]
1.20.5 ~ 1.21.4:/give @s netherite_pickaxe[enchantments={levels:{efficiency:5,fortune:3,unbreaking:3,mending:1}}]
1.16 ~ 1.20.4:/give @s netherite_pickaxe{Enchantments:[{id:"minecraft:efficiency",lvl:5s},{id:"minecraft:fortune",lvl:3s},{id:"minecraft:unbreaking",lvl:3s},{id:"minecraft:mending",lvl:1s}]}

Unbreakable Diamond Sword

/give @s diamond_sword[unbreakable={}]
1.20.4 and earlier:/give @s diamond_sword{Unbreakable:1b}

Enchanted Golden Apple

/give @s enchanted_golden_apple 64

Elytra

/give @s elytra

Barrier, Structure Block, Debug Stick

/give @s barrier/give @s structure_block/give @s debug_stick

Light Block

/give @s light

Add 100 Levels

/xp add @s 100 levels

Effect Commands

Night Vision Forever

Effect Command Generator ›
/effect give @s night_vision infinite 0 true
1.19.3 and earlier:/effect give @s night_vision 1000000 0 true

Invincibility Command

/effect give @s resistance infinite 4 true/effect give @s regeneration infinite 4 true/effect give @s saturation infinite 0 true

Resistance V grants immunity to most damage (except The Void and /kill).

1.19.3 and earlier:/effect give @s resistance 1000000 4 true /effect give @s regeneration 1000000 4 true /effect give @s saturation 1000000 0 true

Permanent Haste (mine faster)

/effect give @s haste infinite 1 true
1.19.3 and earlier:/effect give @s haste 1000000 1 true

Speed and Jump Boost

/effect give @s speed infinite 1 true/effect give @s jump_boost infinite 1 true
1.19.3 and earlier:/effect give @s speed 1000000 1 true /effect give @s jump_boost 1000000 1 true

Clear all effects

/effect clear @s

World and Mobs

Find the Nearest Village

/locate structure #village
1.18.2:/locate #village
1.16 ~ 1.18.1:/locate village
1.15.2 and earlier:/locate Village

Find a Biome

/locate biome jungle

Replace `jungle` with the biome you want to find.

1.16 ~ 1.18.2:/locatebiome jungle

View World Seed

/seed

Remove dropped items

/kill @e[type=item]

Remove Nearby Zombies

/kill @e[type=zombie,distance=..50]

Replace `zombie` with the mob you want to remove. `distance=..50` means within 50 blocks.

Summon Lightning

/summon lightning_bolt ~ ~ ~
/summon wither ~ ~ ~

Summon an Immobile Villager

/summon villager ~ ~ ~ {NoAI:1b,Invulnerable:1b,PersistenceRequired:1b}

Clear Nearby Blocks

Block Command Generator ›
/fill ~-5 ~ ~-5 ~5 ~5 ~5 air

Server Management

Give a Player Operator Permissions

/op Steve

Use `/deop Steve` to revoke them.

Kick and Ban Players

/kick Steve/ban Steve

Use `/pardon Steve` to unban them.

Whitelist

/whitelist on/whitelist add Steve

Server-Wide Announcement (Colored Text)

tellraw Command Generator ›
/tellraw @a ["",{text:"[公告] ",color:"gold",bold:true},{text:"服务器将在 5 分钟后重启",color:"yellow"}]
1.21.4 and earlier:/tellraw @a ["",{"text":"[公告] ","color":"gold","bold":true},{"text":"服务器将在 5 分钟后重启","color":"yellow"}]

Show a Large Title in the Center of the Screen

title Command Generator ›
/title @a title {text:"欢迎来到服务器",color:"aqua"}
1.21.4 and earlier:/title @a title {"text":"欢迎来到服务器","color":"aqua"}

This page collects the most commonly used Minecraft commands. Each one is ready to copy and uses the correct syntax for the version selected in the top-right corner. Syntax for other versions is also listed below each command. For example, to keep items on death, versions 1.21.11 and later use /gamerule keep_inventory true, while earlier versions use /gamerule keepInventory true。

Frequently Asked Questions

What should I do if a command returns “Unknown or incomplete command”?

First, check that you have permission: in singleplayer, enable “Allow Cheats” when creating the world (or temporarily enable it using “Open to LAN” in an existing world). On a server, you need operator (OP) permissions. Then check the version: select your game version in the top right before copying the command. Many online guides show outdated syntax that causes errors in newer versions.

What are Minecraft cheat codes?

Minecraft doesn't have traditional cheat codes; what people call “cheat codes” are these commands. Enable cheats (Allow Cheats or OP permissions), then enter a command in chat.

What are the Creative Mode and Survival Mode commands?

Creative Mode /gamemode creative, Survival Mode /gamemode survival, Adventure Mode /gamemode adventure, Spectator Mode /gamemode spectator. Since 1.13, you can no longer use numbers (such as /gamemode 1).

Do these commands work in Bedrock Edition (mobile)?

This page shows the Java Edition (PC) syntax. Most basic commands in Bedrock Edition (mobile), such as `gamemode`, `time`, `weather`, `tp`, and `give` for normal items, are the same, but game rule names, item data, and enchantment syntax differ.

What if the command you need isn't here?

UseAll Commands Generatorto build any vanilla command step by step, or use AI Command Generatorto describe what you want in plain words.