Minecraft Commands: 30 Most Useful Commands & Cheats (Copy-Paste)
The 30 Minecraft commands you’ll actually use, with copy-paste examples — from /gamemode and /give to /locate and keepInventory — for Java and Bedrock.

Minecraft commands are typed in chat starting with a slash. Turn on Allow Cheats first, press T (or /) to open chat, then type a command such as /gamemode creative, /give @s diamond 64 or /time set day and press Enter.
In this guide
- How to turn on cheats
- Target selectors
- The 30 most useful Minecraft commands
- What does ~ mean in commands?
- Item and mob IDs
- Handy command combos
- Useful /locate structure IDs
- Commands for server owners
- Common command errors and fixes
- Command blocks
- Commands for building faster
- Teleport tips
- Are commands cheating?
- Java vs Bedrock differences
Minecraft commands let you change almost anything about your world: switch game modes, give yourself items, teleport, change the weather or find the nearest village. Below are the 30 most useful Minecraft commands with ready-to-copy examples, plus how to turn cheats on and the target selectors that make commands powerful.
- Open chat
- T or / (Java) · chat button (Bedrock)
- Needs
- Cheats / operator permission
- Affects achievements?
- Bedrock: yes · Java: no achievements system
- Target yourself
- @s
- All players
- @a
- Nearest player
- @p
How to turn on cheats
- 💻 Java Edition (single player): when creating a world, set Allow Cheats: ON. For an existing world, press Esc → Open to LAN → Allow Cheats: ON (this lasts until you quit).
- 📱 Bedrock Edition: in world settings, turn on Activate Cheats. This disables achievements for that world permanently.
- 🖥️ Servers: you need operator permission (
/op yournamefrom the console).
Target selectors
| Selector | Means |
|---|---|
@s | Yourself (the one running the command) |
@p | The nearest player |
@a | All players |
@r | A random player |
@e | All entities (mobs, items, players) |
The 30 most useful Minecraft commands
Game mode and difficulty
| Command | What it does |
|---|---|
/gamemode creative | Switch to Creative mode (also survival, adventure, spectator) |
/difficulty peaceful | No hostile mobs (also easy, normal, hard) |
/gamerule keep_inventory true | Keep your items when you die (Bedrock: keepInventory) |
/gamerule advance_time false | Stop time (Bedrock: doDaylightCycle) |
/gamerule advance_weather false | Stop weather changing (Bedrock: doWeatherCycle) |
/gamerule spawn_mobs false | Stop mobs spawning naturally (Bedrock: doMobSpawning) |
Items and XP
| Command | What it does |
|---|---|
/give @s diamond 64 | Give yourself 64 diamonds |
/give @s netherite_sword | Give any item by its ID |
/xp add @s 30 levels | Add 30 XP levels (Java; Bedrock: /xp 30L @s) |
/enchant @s sharpness 5 | Enchant the item in your hand |
/clear @s | Empty your inventory |
Time and weather
| Command | What it does |
|---|---|
/time set day | Make it morning (also noon, night, midnight) |
/weather clear | Stop rain (also rain, thunder) |
Moving around
| Command | What it does |
|---|---|
/tp @s 100 64 -200 | Teleport to coordinates X Y Z |
/tp @s PlayerName | Teleport to another player |
/spawnpoint | Set your respawn point where you stand |
/setworldspawn | Set the world spawn point |
/locate structure minecraft:village_plains | Find the nearest plains village |
/locate biome minecraft:cherry_grove | Find the nearest cherry grove |
Effects and mobs
| Command | What it does |
|---|---|
/effect give @s night_vision 600 0 | Night Vision for 10 minutes |
/effect give @s regeneration 60 2 | Regeneration III for 1 minute |
/effect clear @s | Remove all effects |
/summon minecraft:horse | Spawn any mob where you stand |
/kill @e[type=minecraft:zombie] | Remove all zombies |
/effect give @s instant_health 1 4 | Instant full heal (there is no /heal command) |
Building
| Command | What it does |
|---|---|
/fill ~ ~ ~ ~10 ~5 ~10 stone | Fill an area with a block |
/fill ~-5 ~ ~-5 ~5 ~5 ~5 air | Clear an area around you |
/setblock ~ ~ ~ diamond_block | Place one block |
/clone | Copy a region to another place |
/seed | Show your world seed |
What does ~ mean in commands?
The tilde ~ means “relative to me”. ~ ~ ~ is your exact position, ~ ~10 ~ is 10 blocks above you, and ~5 ~ ~ is 5 blocks east. It’s how you place things near yourself without knowing exact coordinates. Check your coordinates with F3 on Java or the Show Coordinates setting on Bedrock.
Item and mob IDs
Commands use IDs like diamond_sword or creeper — usually the name in lowercase with underscores. Our Minecraft items database lists every item, and the mobs database lists every mob. For example, the Diamond Sword page shows the recipe and stats, and its command ID is diamond_sword.
Handy command combos
- 🛡️ Never lose items:
/gamerule keep_inventory true(Java) or/gamerule keepInventory true(Bedrock) - ☀️ Endless sunny day:
/time set day+/gamerule advance_time false+/weather clear - 💎 Find diamonds faster:
/effect give @s night_vision 999999 0+/tp @s ~ -58 ~(careful — you may land in a cave) - 🏘️ Find a village:
/locate structure #minecraft:village
Useful /locate structure IDs
| Structure | Java command |
|---|---|
| Stronghold (End portal) | /locate structure minecraft:stronghold |
| Ancient city | /locate structure minecraft:ancient_city |
| Trial chambers | /locate structure minecraft:trial_chambers |
| Woodland mansion | /locate structure minecraft:mansion |
| Ocean monument | /locate structure minecraft:monument |
| Nether fortress | /locate structure minecraft:fortress |
| Bastion remnant | /locate structure minecraft:bastion_remnant |
| End city | /locate structure minecraft:end_city |
Commands for server owners
| Command | What it does |
|---|---|
/op PlayerName | Give a player operator permissions |
/deop PlayerName | Remove operator permissions |
/whitelist add PlayerName | Allow a player on a whitelisted server |
/kick PlayerName | Remove a player from the server |
/ban PlayerName | Ban a player |
/list | Show who is online |
Common command errors and fixes
- ❗ “Unknown or incomplete command” — check the spelling, or that you’re on the right edition (Java and Bedrock differ).
- ❗ “You do not have permission” — turn on cheats or ask a server operator.
- ❗ “No entity was found” — your target selector didn’t match anyone, for example
@e[type=zombie]with no zombies loaded nearby. - ❗ “That position is not loaded” — you tried to place blocks too far away. Move closer.
Command blocks
Command blocks run commands automatically, for example when powered by redstone. Get one with /give @s command_block (only in Creative with cheats on). They’re used to build adventure maps, mini-games and automatic farms.
Commands for building faster
Builders love commands. /fill can place up to tens of thousands of blocks at once, and adding hollow at the end makes a hollow box — perfect for quick room shells. /fill ~-10 ~-1 ~-10 ~10 ~-1 ~10 grass_block flattens a 21×21 floor under you. /clone copies a structure from one spot to another, and /setblock places a single block precisely, which is handy for redstone. Always save or back up your world before big edits, because commands can’t be undone with a button.
Teleport tips
Teleporting to a high Y value is safe, but teleporting low can drop you into stone, lava or caves. Use /tp @s ~ ~100 ~ to jump straight up for a view of the area, and /spawnpoint before risky trips. In the Nether, coordinates are 8 times smaller: dividing your Overworld X and Z by 8 tells you where to build a linked portal.
Are commands cheating?
It depends on how you play. In creative builds, adventure maps and servers, commands are simply tools. In a survival world, many players use only a few “quality of life” commands like /locate or keep inventory, while others avoid them completely for the challenge. There’s no wrong answer — just remember that on Bedrock, turning on cheats disables achievements for that world.
Tip: in Java Edition, press the Up arrow in chat to repeat the last command you typed — perfect for running the same /fill or /tp several times while building.
Java vs Bedrock differences
Most commands work the same way, but a few differ. Since Java 1.21.11, game rules use new lowercase names like keep_inventory and advance_time, while Bedrock keeps the old names like keepInventory. Bedrock uses /xp 30L @s for levels, while Java uses /xp add @s 30 levels. Some gamerules and structure names also differ, and Bedrock commands autocomplete differently. When in doubt, start typing and press Tab (Java) or watch the suggestions above the chat box.
Ready to play without commands too? Learn the best Y level for diamonds and the Minecraft potions brewing chart.
Sources
- Minecraft Wiki — Commands · minecraft.wiki