Minecraft commands (often called cheats) let you change the game by typing into chat. Press T or / on PC, the chat button on mobile, or right on the D-pad on console, then type a command that starts with a slash, like /gamemode creative or /time set day.
This page lists every command most players will ever need, grouped by what you’re trying to do, with examples you can copy. Each one notes whether it works on Java, Bedrock or both.
Quick answer: The five commands people use most are /gamemode creative, /time set day, /weather clear, /gamerule keepInventory true and /tp @s ~ ~10 ~. Cheats must be on for any of them to work.
In this guide
- How to turn on cheats
- Coordinates and target selectors (read this first)
- Most popular commands
- Time, weather and world commands
- Player commands: gamemode, give, effect, XP
- Teleport and locate commands
- Building commands: fill, setblock, clone
- Mob commands: summon and kill
- Most useful gamerules
- Multiplayer and server commands
- Advanced commands
- Command not working? Fixes
- FAQ
How to turn on cheats in Minecraft
Java Edition
- New world: in Create New World, set Allow Commands to ON.
- Existing world: press Esc, choose Open to LAN, set Allow Commands to ON and click Start LAN World. This only lasts until you leave, so run
/gamerulechanges while it’s on. - Servers: you need operator status. The server owner runs
/op YourNamefrom the console.
Bedrock Edition (Windows, Xbox, PlayStation, Switch, mobile)
- Open the world’s Edit menu, go to Cheats and toggle Activate Cheats on.
- Turning on cheats permanently disables achievements for that world. Make a copy first if you care about them.
Coordinates and target selectors: read this first
Most commands need a target and sometimes a position. Learn these once and every command gets easier.
| Selector | Targets | Example |
|---|---|---|
@s |
Yourself | /effect give @s night_vision |
@p |
Nearest player | /give @p diamond 5 |
@a |
All players | /tp @a @s |
@r |
Random player | /give @r cake |
@e |
All entities (mobs, items, players) | /kill @e[type=zombie] |
- Absolute coordinates are plain numbers:
/tp @s 100 64 -200. - Relative coordinates use
~and mean “from where I am”:/tp @s ~ ~10 ~moves you 10 blocks up. - Local coordinates use
^and mean “from where I’m looking”:/tp @s ^ ^ ^5moves you 5 blocks forward. - Press F3 (Java) or turn on Show Coordinates in world settings (Bedrock) to see your position.
Most popular Minecraft commands
| Command | What it does | Edition |
|---|---|---|
/gamemode creative |
Switch to creative (also survival, adventure, spectator) |
Both |
/time set day |
Make it morning (also noon, night, midnight) |
Both |
/weather clear |
Stop rain or thunder (also rain, thunder) |
Both |
/gamerule keepInventory true |
Keep items when you die. Full guide: keep inventory | Both |
/give @s diamond 64 |
Give yourself 64 diamonds | Both |
/locate structure village_plains |
Find the nearest plains village | Both (Bedrock: /locate structure village) |
/tp @s 0 100 0 |
Teleport to coordinates | Both |
/effect give @s night_vision infinite |
Permanent night vision | Both |
/difficulty peaceful |
Remove hostile mobs | Both |
/seed |
Show your world’s seed. Browse more in our best seeds list | Java (Bedrock shows it in world settings) |
Time, weather and world commands
| Command | Example | Notes |
|---|---|---|
| /time | /time set 6000 |
0 = sunrise, 6000 = noon, 13000 = night, 18000 = midnight. Bedrock 26.x also adds /time pause and /time resume. |
| /weather | /weather clear 999999 |
Optional duration in seconds (Java) or ticks (Bedrock). |
| /difficulty | /difficulty hard |
peaceful, easy, normal, hard |
| /setworldspawn | /setworldspawn ~ ~ ~ |
Moves world spawn to where you stand |
| /spawnpoint | /spawnpoint @s |
Sets your personal respawn point without a bed |
| /worldborder | /worldborder set 2000 |
Java. Great for small SMP worlds. |
| /defaultgamemode | /defaultgamemode survival |
Mode new players join in |
Player commands: gamemode, give, effect and XP
| Command | Example | What it does |
|---|---|---|
| /give | /give @s netherite_sword 1 |
Gives an item. Use the item ID, not the display name. |
| /enchant | /enchant @s sharpness 5 |
Enchants the held item up to its normal max level |
| /effect give | /effect give @s speed 300 1 |
Applies an effect for 300 seconds at level II (levels start at 0) |
| /effect clear | /effect clear @s |
Removes all effects |
| /xp or /experience | /xp add @s 30 levels |
Java. Bedrock uses /xp 30L @s |
| /clear | /clear @s dirt |
Removes items from an inventory |
| /heal-style trick | /effect give @s instant_health 1 10 |
There is no /heal; this refills health instantly |
| /ability | /ability @s mayfly true |
Bedrock with Education features: lets you fly in survival |
Want to know what each enchantment does before using /enchant? See the full Minecraft enchantments list.
Teleport and locate commands
| Command | Example | What it does |
|---|---|---|
| /tp to player | /tp @s Steve |
Teleports you to another player |
| /tp to coordinates | /tp @s 250 70 -1200 |
Teleports to an exact spot |
| /locate structure | /locate structure trial_chambers |
Finds a structure; click the result in Java to teleport |
| /locate biome | /locate biome cherry_grove |
Finds a biome |
| /locate poi | /locate poi minecraft:bee_nest |
Java: finds points of interest such as bee nests or job blocks |
| /execute in | /execute in the_nether run tp @s 0 70 0 |
Java: teleports between dimensions |
Step-by-step guides: teleport to a village, find Trial Chambers and teleport to spawn.
Building commands: fill, setblock and clone
| Command | Example | What it does |
|---|---|---|
| /setblock | /setblock ~ ~-1 ~ diamond_block |
Places one block |
| /fill | /fill ~-5 ~ ~-5 ~5 ~5 ~5 air |
Fills a box; using air clears an area (max 32,768 blocks per command) |
| /fill … replace | /fill ~-10 ~-5 ~-10 ~10 ~5 ~10 air replace stone |
Replaces only one block type |
| /fill … hollow | /fill ~ ~ ~ ~10 ~6 ~10 glass hollow |
Builds an empty box (instant room) |
| /clone | /clone 0 64 0 10 70 10 20 64 0 |
Copies a build to a new spot |
More detail in our guides on removing blocks with /fill and /setblock and the best commands for creative building.
Mob commands: summon and kill
| Command | Example | What it does |
|---|---|---|
| /summon | /summon minecraft:wolf ~ ~ ~ |
Spawns a mob at your position |
| /summon lightning | /summon lightning_bolt ~ ~ ~5 |
Calls lightning (turns pigs into zombified piglins, villagers into witches) |
| /kill | /kill @e[type=item] |
Deletes all dropped items to reduce lag |
| /kill hostile mobs | /kill @e[type=!player,distance=..50] |
Java: kills everything except players within 50 blocks. Careful with pets. |
| /kill yourself | /kill @s |
Respawn instantly (unstuck yourself) |
Most useful Minecraft gamerules
| Gamerule | Set to | Effect |
|---|---|---|
| keepInventory | true | Keep items and XP on death |
| doDaylightCycle | false | Freeze time (always day if you run /time set day first) |
| doWeatherCycle | false | Stop weather from changing |
| mobGriefing | false | Creepers stop breaking blocks, endermen stop moving them. See disable explosions |
| doInsomnia | false | No phantoms. See disable phantoms |
| playersSleepingPercentage | 0–100 | Java: how many players must sleep to skip night (Bedrock: playersSleepingPercentage too) |
| doImmediateRespawn | true | Skip the death screen |
| randomTickSpeed | 3 (default) | Higher = crops and trees grow faster. 100+ can lag your game. |
| doFireTick | false | Fire stops spreading |
| showCoordinates | true | Bedrock: shows coordinates on screen |
| naturalRegeneration | false | Health only regenerates from potions and golden apples (UHC mode) |
Type /gamerule followed by a space to see every rule your version supports. Java 26.x is moving gamerule names to snake_case in some snapshots, so if a camelCase name is rejected, try the suggestions that pop up in chat.
Multiplayer and server commands
| Command | What it does |
|---|---|
/op Name / /deop Name |
Give or remove operator powers. See how to un-OP someone |
/kick Name reason |
Remove a player from the session |
/ban Name / /pardon Name |
Ban or unban (Java servers) |
/whitelist add Name |
Allow only listed players |
/msg Name text or /w |
Private message |
/list |
Show who is online |
/save-all |
Force-save the world (Java servers) |
Advanced commands worth knowing
/executeruns a command as or at something else:/execute as @e[type=cow] run tp @s ~ ~1 ~lifts every cow one block./scoreboardtracks stats like deaths:/scoreboard objectives add deaths deathCount./titleshows big on-screen text for maps:/title @a title {"text":"Round 1"}(Java)./tick freezeand/tick rate 40(Java) pause or speed up the game for testing farms./random value 1..6(Java) rolls dice in chat.- Command blocks:
/give @s command_block, then place it and type a command inside. See how to turn off command block output to stop chat spam.
Minecraft command not working? Quick fixes
| Error or problem | Fix |
|---|---|
| “Unknown or incomplete command” | Check spelling and the edition column above. Java and Bedrock syntax differ for /xp, /locate and some gamerules. |
| “You do not have permission” | Cheats are off, or you’re not an operator on the server. |
| Item command fails | Use the item ID (golden_apple), not the display name (“Golden Apple”). |
| /fill says “too many blocks” | Split the area into smaller boxes; the limit is 32,768 blocks. |
| Commands greyed out on console | Edit the world and toggle Activate Cheats; it can’t be done mid-session on Realms without owner rights. |
Frequently asked questions
Do commands disable achievements?
On Bedrock, yes: turning on cheats disables achievements for that world forever. Java has no achievements to lose, but advancements still work.
Can you use commands on Minecraft Realms?
Yes, if the Realm owner turns on cheats in the Realm settings. That disables achievements on Bedrock Realms.
What is the command to fly in survival?
Java has no fly command; switch to /gamemode creative or /gamemode spectator. On Bedrock with Education Edition features enabled, /ability @s mayfly true lets you fly in survival.
What is the command for unlimited health?
/effect give @s resistance infinite 255 true makes you take no damage in most cases, and /effect give @s saturation infinite 255 true keeps you fed.
How do I find diamonds with commands?
There is no locate-ore command. Use /effect give @s night_vision infinite and mine at the right height; our diamond Y-level guide shows where.
Version notes
Tested against Java 26.3 and Bedrock 26.50 in November 2026. Some syntax (especially gamerule names) may change in The Deep Freeze update; we’ll keep this page current. Find the newest features in our Deep Freeze update guide.

Abhigyan identifies himself as a tech geek, gaming cognoscenti, and also a connoisseur of music. Unidentified and mysterious phenomena never fail to gather his undivided attention. When not reading about bizarre and perplexing entities across the Universe, he can often be found cheering for his favorite teams in Football.
Our guides are researched, fact-checked and updated as games change. How we research and verify our guides.