Minecraft commands turn the game from an open sandbox into a fully programmable world. Whether you want to teleport across the map in an instant, fill a valley with lava, spawn a hundred creepers at once, or automate your server with command blocks, knowing your way around the command console is essential in 2026.
This guide covers every major command category for Java Edition and Bedrock Edition 1.21+, including syntax differences, a top-20 command list, a full reference table, step-by-step tutorials, and a multiplayer admin section. Bookmark it — you’ll come back to it.
How to Enable Cheats and Open the Console
Commands only work when cheats are enabled. Here’s how to turn them on per platform:
- Singleplayer (Java): When creating a world, open the “More World Options” screen and toggle Allow Cheats: ON. On an existing world, open to LAN and enable cheats from the pause menu.
- Singleplayer (Bedrock): Under “Game” settings when creating the world, toggle Activate Cheats. Note: this disables achievements for that world.
- Multiplayer / Servers: Operators (OP level 2+) can run commands freely. Set
enable-cheats=trueinserver.propertiesfor non-OP players to use them.
To open the command console press / (Java) or tap the chat icon then type / (Bedrock). Tab-completion works on both editions — use it constantly to avoid typos.
Target Selectors: The Foundation of Every Command
Most commands accept a target. Understanding selectors saves you from typing player names by hand every time.
| Selector | Targets | Works in |
|---|---|---|
@s | Yourself (the command sender) | Both |
@p | Nearest player | Both |
@a | All players | Both |
@e | All entities (mobs, items, arrows) | Both |
@r | A random player | Both |
@n | Nearest entity of any type | Bedrock only |
Selectors can be filtered with arguments in square brackets. For example, @e[type=zombie,distance=..20] targets all zombies within 20 blocks. Java Edition supports more complex NBT-based filtering; Bedrock covers most common use cases.
Top 20 Must-Know Minecraft Commands
These are the commands every player, builder, and server admin should have memorised. Each includes a one-line summary and a real example.
| # | Command | What it does | Example |
|---|---|---|---|
| 1 | /gamemode | Switch game mode instantly | /gamemode creative @s |
| 2 | /tp | Teleport yourself or others | /tp Steve 100 64 -200 |
| 3 | /give | Put items straight into a player’s inventory | /give @s diamond 64 |
| 4 | /kill | Kill entities (use with care on @a) | /kill @e[type=creeper] |
| 5 | /summon | Spawn any mob or entity | /summon wither ~ ~5 ~ |
| 6 | /time set | Change the world time | /time set day |
| 7 | /weather | Control the weather | /weather clear 6000 |
| 8 | /gamerule | Toggle world rules like mob spawning or fire spread | /gamerule doMobSpawning false |
| 9 | /effect give | Apply a status effect to a player | /effect give @s speed 60 2 |
| 10 | /enchant | Enchant the item in hand | /enchant @s sharpness 5 |
| 11 | /fill | Fill a region with a specific block | /fill ~-5 ~ ~-5 ~5 ~10 ~5 air |
| 12 | /setblock | Place a single block at exact coordinates | /setblock 0 64 0 minecraft:chest |
| 13 | /clone | Copy a region of blocks to another location | /clone 0 60 0 10 70 10 50 60 50 |
| 14 | /locate | Find the nearest structure or biome | /locate structure minecraft:village |
| 15 | /seed | Show the world seed | /seed |
| 16 | /xp add | Add experience points or levels | /xp add @s 30 levels |
| 17 | /clear | Remove items from a player’s inventory | /clear @s dirt |
| 18 | /difficulty | Change world difficulty | /difficulty hard |
| 19 | /scoreboard | Create and manage scoreboards for minigames | /scoreboard objectives add kills playerKillCount |
| 20 | /execute | Run commands from another entity’s position or perspective | /execute as @e[type=zombie] run kill @s |
Full Command Reference Table
Every commonly used Minecraft command, its purpose, an example, and platform compatibility at a glance.
| Command | Description | Example Usage | Java | Bedrock |
|---|---|---|---|---|
/gamemode | Set game mode | /gamemode survival @a | ✓ | ✓ |
/tp / teleport | Teleport entities | /tp @p 0 64 0 | ✓ | ✓ |
/give | Give items | /give Steve netherite_sword 1 | ✓ | ✓ |
/kill | Kill entities | /kill @e[type=!player] | ✓ | ✓ |
/summon | Spawn entities | /summon creeper ~ ~ ~ | ✓ | ✓ |
/time set | Set world time | /time set noon | ✓ | ✓ |
/time add | Advance time by ticks | /time add 1000 | ✓ | ✓ |
/weather | Set weather | /weather thunder 3000 | ✓ | ✓ |
/difficulty | Change difficulty | /difficulty peaceful | ✓ | ✓ |
/gamerule | Toggle game rules | /gamerule keepInventory true | ✓ | ✓ |
/effect give | Apply status effect | /effect give @a night_vision 120 0 | ✓ | ✓ |
/effect clear | Remove all effects | /effect clear @s | ✓ | ✓ |
/enchant | Enchant held item | /enchant @s unbreaking 3 | ✓ | ✓ |
/xp add | Grant XP | /xp add @s 100 points | ✓ | ✓ |
/fill | Fill region with block | /fill 0 60 0 10 70 10 stone | ✓ | ✓ |
/setblock | Place single block | /setblock ~ ~-1 ~ bedrock | ✓ | ✓ |
/clone | Copy block region | /clone 0 60 0 5 65 5 20 60 20 | ✓ | ✓ |
/locate structure | Find nearest structure | /locate structure village | ✓ | ✓ |
/locate biome | Find nearest biome | /locate biome jungle | ✓ | ✓ |
/seed | Show world seed | /seed | ✓ | ✓ |
/clear | Clear inventory | /clear @s sand 64 | ✓ | ✓ |
/say | Broadcast a message | /say Server restarting in 5 min | ✓ | ✓ |
/title | Display title on screen | /title @a title {"text":"Round 1"} | ✓ | ✓ |
/scoreboard | Manage scoreboards | /scoreboard players add @a deaths 0 | ✓ | ✓ |
/execute | Run commands conditionally | /execute if entity @a[tag=winner] run say GG | ✓ | ✓ |
/ban | Ban a player | /ban griefer Griefing spawn | ✓ | Server |
/kick | Disconnect a player | /kick Steve Back in 5 | ✓ | ✓ |
/whitelist | Manage server whitelist | /whitelist add NewPlayer | ✓ | ✓ |
/op | Grant operator status | /op TrustedAdmin | ✓ | ✓ |
/deop | Remove operator status | /deop FormerAdmin | ✓ | ✓ |
/list | Show online players | /list | ✓ | ✓ |
/stop | Stop the server | /stop | ✓ | Server |
/reload | Reload datapacks/functions | /reload | ✓ | ✓ |
/publish | Open singleplayer to LAN | /publish 25565 | ✓ | ✓ |
/tickingarea | Create a persistent loaded chunk area | /tickingarea add 0 0 0 100 100 100 farm | ✗ | ✓ |
/forceload | Force chunks to stay loaded | /forceload add 0 0 | ✓ | ✗ |

Player Management Commands
Player management is the bread and butter of multiplayer server administration. These commands let you control who is online, how they play, and what they can do.
Game Mode Switching
Switch modes for yourself or every player simultaneously:
/gamemode creative @s— you enter Creative mode/gamemode survival @a— everyone reverts to Survival/gamemode spectator Steve— specific player becomes a spectator
Valid modes: survival (0), creative (1), adventure (2), spectator (3).
Healing and Status
/effect give @s instant_health 1 10— heal yourself immediately (amplifier 10 = max heal)/effect give @a saturation 10 255 true— keep all players fed, hide particles/effect clear @s— remove all effects (useful after accidental poisoning)
Experience
The /xp command accepts points (raw XP) or levels. Use levels for fast enchanting:
/xp add @s 30 levels— add 30 levels instantly/xp set @s 0 levels— reset level to 0
For a deeper look at farming XP legitimately, see our Minecraft XP farms guide.
World and Terrain Commands
These commands reshape the world, control time and weather, and help you navigate vast maps quickly.
Time Control
Minecraft’s day cycle is 24,000 ticks (roughly 20 minutes real time):
/time set day— sunrise (1000 ticks)/time set noon— midday (6000 ticks)/time set night— nightfall (13000 ticks)/time set midnight— full dark (18000 ticks)/gamerule doDaylightCycle false— freeze time at current value
Weather Control
/weather clear 72000— clear skies for one in-game day (72000 ticks ≈ 1 hour real time)/weather rain 12000— rain for 10 minutes/weather thunder— thunderstorm (useful for channeling tridents)/gamerule doWeatherCycle false— lock weather permanently
Block Placement
The /fill command is the fastest way to build or clear large areas. The syntax is:
/fill <x1> <y1> <z1> <x2> <y2> <z2> <block> [replace|destroy|hollow|outline|keep]
/fill ~-5 ~ ~-5 ~5 ~10 ~5 air— clear a 10×10 area around you/fill ~-5 ~-1 ~-5 ~5 ~-1 ~5 grass_block— lay a flat grass platform/fill 0 0 0 100 100 100 air replace water— drain water in a region
The ~ symbol means relative to your current position. ~5 = 5 blocks in that direction from where you stand. ^ (caret) notation is relative to the direction you’re facing in Java Edition.
Finding Structures
The /locate command is invaluable for survival and exploration:
/locate structure minecraft:village/locate structure minecraft:trial_chambers(new in 1.21)/locate biome minecraft:cherry_grove
After locating, combine with /tp @s [coordinates] to jump there instantly.
Item and Inventory Commands
Giving Items
The full syntax: /give <player> <item> [count] [data]
/give @s diamond 64— a full stack of diamonds/give @a netherite_ingot 9— 9 netherite ingots for every player/give @s minecraft:mace 1— the new 1.21 mace weapon
Java Edition tip: Item IDs use namespaced format (minecraft:diamond). The namespace is optional in most commands but required in some contexts. Bedrock uses the same namespace format since 1.16.
Clearing Items
/clear @s— empty your entire inventory/clear @s dirt— remove all dirt only/clear @a gravel 32— remove up to 32 gravel from every player
Enchanting
Requires the target item to be held in the main hand:
/enchant @s sharpness 5/enchant @s efficiency 5/enchant @s mending 1
Some enchantments conflict (Silk Touch vs Fortune) — the command will reject incompatible combinations. For a full breakdown of which enchantments are worth using, see our Minecraft enchantments tier list.
Game Rule and Difficulty Control
Game rules are persistent settings that control how the world behaves. They survive world reloads.
Most Useful Game Rules
| Game Rule | Default | What it controls |
|---|---|---|
keepInventory | false | Keep items on death (great for casual play) |
doMobSpawning | true | Toggle natural mob spawning |
mobGriefing | true | Prevent creepers and endermen from destroying blocks |
doDaylightCycle | true | Freeze the time of day |
doWeatherCycle | true | Lock the current weather |
doFireTick | true | Stop fire from spreading |
pvp | true | Enable/disable player vs player damage |
fallDamage | true | Disable fall damage |
naturalRegeneration | true | Toggle passive health regeneration |
randomTickSpeed | 3 | Speed up crop growth, leaf decay (set to 20 for fast farms) |
spawnRadius | 10 | Radius around spawn point where players respawn |
announceAdvancements | true | Hide advancement notifications in chat |
Syntax: /gamerule <rule> <true|false> or a numeric value for rules like randomTickSpeed.
Difficulty
/difficulty peaceful — no hostile mobs, health regenerates
/difficulty easy — reduced mob damage
/difficulty normal — standard gameplay
/difficulty hard — increased damage, hunger can kill, villagers turn into zombies
Command Block Usage
Command blocks bring commands into the world itself — no player needs to type anything. They’re the engine behind most minigames, adventure maps, and automated farms. For a deeper dive into automation, see our Minecraft Redstone guide.
Getting a Command Block
Command blocks cannot be crafted. You must give them with a command (requires Creative mode or OP status):
/give @s minecraft:command_block
Types of Command Block
- Impulse (orange): Runs once per redstone pulse.
- Chain (teal): Runs when the block behind it activates. Used for sequences.
- Repeat (purple): Runs every game tick while powered. Use sparingly — it fires 20 times per second.
Mini Tutorial: Simple Repeat Command Block Timer
- Place a Repeat command block and open its interface (right-click).
- Set it to Always Active (no redstone needed).
- Enter the command:
/time add 1 - This speeds the day cycle. For a toggleable version, connect a lever to the block instead.
Step-by-Step Mini Tutorials
Teleporting Players
To exact coordinates:
/tp @s 150 70 -300To another player:
/tp Steve AlexTo yourself (reset facing direction):
/tp @s ~ ~ ~ 0 0The last two numbers are yaw (horizontal rotation) and pitch (vertical). 0 0 faces due south, level.
Bedrock note: The /teleport alias works on both editions. Bedrock also accepts /tp with the same syntax.
Summoning Mobs
Basic summon at your feet:
/summon zombie ~ ~ ~Summon a named mob (Java NBT):
/summon skeleton ~ ~1 ~ {CustomName:'"Skelly"'}Summon a charged creeper (Java):
/summon creeper ~ ~ ~ {powered:1b}Bedrock NBT is more limited. Most basic summons work identically, but complex NBT tags (custom names, specific equipment) are Java-only or use different syntax in Bedrock.
Giving Items
One item:
/give @s elytra 1Full stack of arrows to all players:
/give @a arrow 64Give a potion (Java with NBT data):
/give @s minecraft:potion{Potion:"minecraft:strong_swiftness"} 1Changing Time and Weather
Create a quick day/night toggle with two commands or a command block:
/time set 0
/gamerule doDaylightCycle falseLock to daytime permanently. To resume the cycle:
/gamerule doDaylightCycle trueFor weather:
/weather clear 999999
/gamerule doWeatherCycle falseAutomating with Command Blocks
Scenario: announce when a player enters a region
- Place a Repeat command block at the border of your area.
- Set it to Always Active.
- Enter:
/execute if entity @a[x=0,y=60,z=0,dx=20,dy=10,dz=20] run say A player has entered the farm! - This checks every tick if any player is within the defined box and broadcasts the message.
Chain multiple command blocks in sequence for more complex logic — Impulse triggers the first, Chain blocks run in order behind it.
Java vs Bedrock: Key Differences
Most commands work on both editions, but there are meaningful differences when building complex systems.
| Feature | Java Edition | Bedrock Edition |
|---|---|---|
| NBT data in commands | Full support ({key:value}) | Limited (basic tags only) |
Selector @n | Not supported | Supported (nearest entity) |
/execute subcommands | Full: if/unless, as/at, positioned, rotated, facing, in, anchored, store | Most subcommands supported; minor syntax differences |
| Chunk management | /forceload | /tickingarea |
| Persistent ticking areas | Not persistent across restarts by default | Named ticking areas survive restarts |
Functions (.mcfunction) | Full datapack support | Behaviour pack functions |
| Item data components (1.20.5+) | New component syntax replaces NBT for items | Still uses older tag approach |
| Resource namespace | minecraft: prefix common | minecraft: prefix also standard |
/ban, /stop | Available in singleplayer + server | Server operator only |
Bottom line: If you’re building adventure maps or complex datapack-driven content, Java is significantly more powerful. For cross-platform play and simpler builds, Bedrock covers everything you need.
Multiplayer and Server Admin Commands
Running a server means knowing how to manage players, permissions, and world state. Here are the commands every server admin needs.
Player Access Control
/whitelist on— restrict the server to whitelisted players only/whitelist add PlayerName— add someone to the list/whitelist remove PlayerName— remove them/whitelist list— see who’s allowed in/whitelist reload— re-read whitelist.json after manual edits
Kicking and Banning
/kick PlayerName Reason here— temporary disconnect with a visible reason/ban PlayerName Griefing spawn area— permanent ban (Java: stored in banned-players.json)/ban-ip 192.168.1.100— IP ban (prevents reconnecting with new account)/pardon PlayerName— unban a player/pardon-ip 192.168.1.100— remove IP ban
Operator Management
/op PlayerName— grant full operator privileges/deop PlayerName— revoke them/list— see who is currently online
Set OP permission levels in server.properties via the op-permission-level value (1–4). Level 4 grants all permissions including bypassing spawn protection.
Troubleshooting with Commands
- Players stuck in walls:
/tp @p ~ ~5 ~to move them up 5 blocks - Entity lag spike:
/kill @e[type=!player]to clear all non-player entities - Mobs piling up:
/kill @e[type=zombie](target specific type) - TPS lag:
/gamerule randomTickSpeed 1to reduce game load - Player items stuck:
/kill @e[type=item]to clear dropped items
For a full walkthrough on setting up your own Minecraft server from scratch, see our Minecraft server setup guide.
The /execute Command: Advanced Usage
/execute is the most powerful command in Minecraft. It lets you run any other command from a different position, entity, or dimension, and add conditional logic.
Core syntax (Java 1.21):
/execute [as|at|positioned|if|unless|in|run] ... run <command>
Useful examples:
/execute as @a at @s run tp @s ~ ~1 ~— nudge every player up 1 block/execute if block ~ ~-1 ~ minecraft:grass_block run say Standing on grass!— check block beneath the sender/execute as @e[type=creeper] at @s run kill @s— instantly kill all creepers from their own position/execute in minecraft:the_nether run tp @s 0 100 0— teleport to Nether coordinates
Frequently Asked Questions
Do commands disable achievements in Minecraft?
In Bedrock Edition, enabling cheats permanently disables achievements for that world. In Java Edition, commands and cheats do not affect advancements unless you use a command that directly changes progression state.
Why isn’t my command working?
The most common reasons: cheats are not enabled, you don’t have OP permissions, there’s a typo in the command (use tab-complete), or the command syntax changed in a recent update. Check the F3 debug screen for your exact coordinates if you’re having teleport issues.
Can I use commands in Hardcore mode?
Not natively. Hardcore mode locks cheats off. The workaround on Java Edition is to open the world to LAN and enable cheats from the LAN menu, but this is a one-time toggle per session.
What’s the difference between /tp and /teleport?
They are identical commands. /teleport is the full name; /tp is the shorthand alias. Both work on Java and Bedrock.
How do I undo a /fill command?
There is no built-in undo. On Java Edition, you can use the F3+Z shortcut to undo the most recent block change if it happened in the last few seconds (requires having a backup). The safest approach is to use /fill with the keep mode, which only fills air blocks and preserves existing blocks.
