Minecraft Commands: The Complete Guide (Java & Bedrock)
Looking to master Minecraft commands? This comprehensive guide lists all commands available in Minecraft Java Edition and Bedrock Edition, ranked by importance. Whether you're a server administrator, map creator, or just curious, discover how to use each command with real examples.
How to Use Minecraft Commands
To execute a Minecraft command, press the T key or / to open the chat, then enter your command.
Prerequisites by Edition
| Edition | Required Condition |
|---|---|
| Java Edition | Enable "cheats" or be server operator |
| Bedrock Edition | Enable cheats AND be operator |
Note: In Java Edition, an operator can run commands even if "Allow Cheats" is off. This is not the case in Bedrock.
Legend for Tables
| Symbol | Meaning |
|---|---|
| ✅ | Available |
| ❌ | Not available |
| 🔒 | Operator required |
| 🔓 | Accessible to all |
Essential Minecraft Commands
The most commonly used Minecraft commands by the community, essential to know.
| Command | Description | Example | Java | Bedrock | Operator |
|---|---|---|---|---|---|
/gamemode | Changes the game mode | /gamemode creative | ✅ | ✅ | 🔒 |
/tp | Teleports players/entities | /tp Steve 100 64 200 | ✅ | ✅ | 🔒 |
/give | Gives items | /give @p diamond 64 | ✅ | ✅ | 🔒 |
/kill | Eliminates entities | /kill @e[type=zombie] | ✅ | ✅ | 🔒 |
/time | Manages world time | /time set day | ✅ | ✅ | 🔒 |
/weather | Changes the weather | /weather clear | ✅ | ✅ | 🔒 |
/gamerule | Modifies rules | /gamerule keepInventory true | ✅ | ✅ | 🔒 |
/effect | Applies effects | /effect give @p strength 60 | ✅ | ✅ | 🔒 |
/summon | Summons entities | /summon minecraft:horse | ✅ | ✅ | 🔒 |
/locate | Finds a structure | /locate structure fortress | ✅ | ✅ | 🔒 |
Details of Essential Commands
/gamemode — Change the game mode ⭐
The most used command to switch between modes.
/gamemode <mode> [player]
| Mode | Alias | Description |
|---|---|---|
survival | 0 | Standard Survival mode |
creative | 1 | Creative mode (flight, infinite resources) |
adventure | 2 | Adventure mode (cannot break blocks) |
spectator | 3 | Spectator mode (pass through blocks) |
Examples:
/gamemode creative— Switches to creative/gamemode survival @a— All players in survival/gamemode 1 Steve— Steve in creative
/tp and /teleport — Teleportation ⭐
Essential for quick movement.
/tp <target> <destination>
/tp <target> <x> <y> <z>
| Syntax | Description |
|---|---|
/tp Steve Alex | Teleports Steve to Alex |
/tp @p 100 64 -300 | Teleports the player to coordinates |
/tp @a ~ ~10 ~ | Raises all players by 10 blocks |
/tp @e[type=cow] @p | Teleports all cows to the player |
Tip: The symbol
~represents the current position.~10means "+10 blocks".
/give — Give Items ⭐
Distributes items to players.
/give <player> <item> [quantity]
| Example | Result |
|---|---|
/give @p diamond 64 | 64 diamonds to the nearest player |
/give @a minecraft:torch 32 | 32 torches to all players |
/give Steve netherite_sword | Netherite sword to Steve |
/give @p enchanted_golden_apple | Enchanted golden apple |
/gamerule — Game Rules ⭐
Modifies fundamental world rules.
/gamerule <rule> <value>
| Rule | Values | Description |
|---|---|---|
keepInventory | true/false | Keep inventory after death |
doDaylightCycle | true/false | Enable day/night cycle |
doMobSpawning | true/false | Mob spawning |
mobGriefing | true/false | Mobs can destroy blocks |
naturalRegeneration | true/false | Natural life regeneration |
doFireTick | true/false | Fire spread |
fallDamage | true/false | Fall damage |
pvp | true/false | Player versus player combat |
Popular Commands:
/gamerule keepInventory true
/gamerule doDaylightCycle false
/gamerule mobGriefing false
/time — Time Management ⭐
Controls the world time.
/time set <value>
/time add <ticks>
/time query <daytime|gametime|day>
| Value | Ticks | Corresponding Time |
|---|---|---|
day | 1000 | Morning (sunrise) |
noon | 6000 | Noon |
night | 13000 | Night (sunset) |
midnight | 18000 | Midnight |
Examples:
/time set day
/time set 6000
/time add 1000
/weather — Weather ⭐
Sets the weather conditions.
/weather <clear|rain|thunder> [duration_in_seconds]
| Command | Effect |
|---|---|
/weather clear | Sunny weather |
/weather rain | Rain |
/weather thunder | Thunderstorm |
/weather clear 999999 | Very long clear weather |
Game Mode and Player Commands
These Minecraft commands modify player states.
| Command | Description | Example | Java | Bedrock | Operator |
|---|---|---|---|---|---|
/effect | Potion effects | /effect give @p speed 120 2 | ✅ | ✅ | 🔒 |
/xp | Gives experience | /xp 30L @p | ✅ | ✅ | 🔒 |
/enchant | Enchants an item | /enchant @p sharpness 5 | ✅ | ✅ | 🔒 |
/clear | Clears inventory | /clear @p | ✅ | ✅ | 🔒 |
/difficulty | Changes difficulty | /difficulty hard | ✅ | ✅ | 🔒 |
/defaultgamemode | Default mode | /defaultgamemode survival | ✅ | ❌ | 🔒 |
/attribute | Modifies attributes | /attribute @p ... base set 40 | ✅ | ❌ | 🔒 |
/spectate | Observe an entity | /spectate @e[type=bat,limit=1] | ✅ | ❌ | 🔒 |
/ability | Special abilities | /ability @p mayfly true | ❌ | ✅ | 🔒 |
/immutableworld | Immutable world | /immutableworld true | ❌ | ✅ | 🔒 |
Player Commands Details
/effect — Potion Effects
Applies or removes status effects.
/effect give <target> <effect> [duration] [amplifier]
/effect clear <target> [effect]
| Effect | ID | Description |
|---|---|---|
speed | 1 | Speed boost |
strength | 5 | Attack strength |
jump_boost | 8 | Enhanced jumping |
regeneration | 10 | Health regeneration |
resistance | 11 | Damage resistance |
fire_resistance | 12 | Fire immunity |
invisibility | 14 | Invisibility |
night_vision | 16 | Night vision |
Examples:
/effect give @p night_vision 9999 0 true
/effect give @a resistance 60 4
/effect clear @p
/xp — Experience
Manages player experience.
/xp <amount>[L] <player>
| Command | Effect |
|---|---|
/xp 1000 @p | Gives 1000 XP points |
/xp 30L @p | Gives 30 levels |
/xp -10L @p | Removes 10 levels |
/xp query @p levels | Displays current level |
/enchant — Enchantments
Enchants the held item.
/enchant <target> <enchantment> [level]
| Enchantment | Max Level | Applicable On |
|---|---|---|
sharpness | 5 | Swords, axes |
efficiency | 5 | Tools |
unbreaking | 3 | All equipment |
fortune | 3 | Pickaxes |
looting | 3 | Swords |
protection | 4 | Armor |
mending | 1 | All equipment |
Examples:
/enchant @p sharpness 5
/enchant @p unbreaking 3
/enchant @p mending 1
/difficulty — Difficulty
Changes the world difficulty.
/difficulty <level>
| Level | Alias | Effects |
|---|---|---|
peaceful | 0 | No hostile mobs, fast regeneration |
easy | 1 | Weak mobs, non-lethal hunger |
normal | 2 | Balance |
hard | 3 | Strong mobs, zombies break doors |
Environment and World Commands
Modify the world with these Minecraft commands.
| Command | Description | Example | Java | Bedrock | Operator |
|---|---|---|---|---|---|
/time | World time | /time set noon | ✅ | ✅ | 🔒 |
/weather | Weather | /weather thunder | ✅ | ✅ | 🔒 |
/gamerule Game rules /gamerule doMobSpawning false ✅ ✅ 🔒 /worldborder World border /worldborder set 1000 ✅ ❌ 🔒 /forceload Load chunks /forceload add 0 0 ✅ ❌ 🔒 /tick Time control /tick freeze ✅ ❌ 🔒 /fillbiome Change biome /fillbiome ... minecraft:jungle ✅ ❌ 🔒 /daylock Lock cycle /daylock true ❌ ✅ 🔒 /toggledownfall Toggle rain /toggledownfall ❌ ✅ 🔒 /tickingarea Active zones /tickingarea add ... ❌ ✅ 🔒 /mobevent Mob events /mobevent ... true ❌ ✅ 🔒 /fog Fog /fog @p push ... ❌ ✅ 🔒 Details of environment commands
/worldborder — World border (Java)
Manages the world's invisible border.
/worldborder <set|add|center|damage|warning> ...
| Command | Effect |
|---|---|
/worldborder set 5000 | Border of 5000 blocks in diameter |
/worldborder set 1000 60 | Shrinks to 1000 blocks in 60 seconds |
/worldborder center 0 0 | Centers at spawn |
/worldborder add 500 | Expands by 500 blocks |
/worldborder damage amount 1 | 1 damage/block outside the border |
/forceload — Forced chunks (Java)
Keeps chunks always loaded (useful for automatic farms).
/forceload add <x> <z>
/forceload remove <x> <z>
/forceload query
| Command | Effect |
|---|---|
/forceload add 0 0 | Loads the chunk at (0,0) |
/forceload add -100 -100 100 100 | Loads an area |
/forceload remove all | Unloads all chunks |
/tickingarea — Active zones (Bedrock)
Bedrock equivalent of /forceload.
/tickingarea add <x1> <y1> <z1> <x2> <y2> <z2> <name>
/tickingarea add circle <x> <y> <z> <radius> <name>
/tickingarea remove <name>
/tickingarea list
Teleportation commands
Instantly move with these Minecraft commands.
| Command | Description | Example | Java | Bedrock | Operator |
|---|---|---|---|---|---|
/tp | Teleportation | /tp @p 0 100 0 | ✅ | ✅ | 🔒 |
/teleport | Alias of /tp | /teleport Steve Alex | ✅ | ✅ | 🔒 |
/spawnpoint | Player spawn | /spawnpoint @p ~ ~ ~ | ✅ | ✅ | 🔒 |
/setworldspawn | World spawn | /setworldspawn 0 64 0 | ✅ | ✅ | 🔒 |
/spreadplayers | Random spread | /spreadplayers 0 0 100 500 false @a | ✅ | ✅ | 🔒 |
/locate | Find structure | /locate structure stronghold | ✅ | ✅ | 🔒 |
/place | Generate structure | /place structure village_plains | ✅ | ✅ | 🔒 |
/structure | Custom structures | /structure save house ... | ❌ | ✅ | 🔒 |
Details of teleportation commands
/locate — Find a structure
Indicates the coordinates of the nearest structure.
/locate structure <type>
/locate biome <biome>
/locate poi <poi>
| Structure | Command |
|---|---|
| Stronghold (End) | /locate structure stronghold |
| Village | /locate structure village |
| Mansion | /locate structure mansion |
| Monument | /locate structure monument |
| Bastion | /locate structure bastion_remnant |
| Nether Fortress | /locate structure fortress |
| Old City | /locate structure ancient_city |
Find a biome :
/locate biome minecraft:mushroom_fields
/locate biome minecraft:cherry_grove
/spreadplayers — Spread
Randomly teleports players within an area.
/spreadplayers <x> <z> <distance_min> <distance_max> <respectTeams> <targets>
| Parameter | Description |
|---|---|
x z | Center of the area |
distance_min | Minimum distance between players |
distance_max | Maximum spread radius |
respectTeams | true = teams together |
Example :
/spreadplayers 0 0 50 500 false @a
Scatters all players between 50 and 500 blocks from the center.
/spawnpoint and /setworldspawn
Set respawn points.
| Command | Scope | Example |
|---|---|---|
/spawnpoint | One player | /spawnpoint Steve 100 64 100 |
/setworldspawn | Everyone | /setworldspawn 0 64 0 |
Building and Editing Commands
Build massively with these Minecraft commands.
| Command | Description | Example | Java | Bedrock | Operator |
|---|---|---|---|---|---|
/setblock | Place a block | /setblock ~ ~ ~ diamond_block | ✅ | ✅ | 🔒 |
/fill | Fills an area | /fill 0 0 0 10 10 10 stone | ✅ | ✅ | 🔒 |
/clone | Copies an area | /clone 0 0 0 10 10 10 20 0 0 | ✅ | ✅ | 🔒 |
/give | Gives items | /give @p diamond_pickaxe | ✅ | ✅ | 🔒 |
/clear | Clears inventory | /clear @p dirt | ✅ | ✅ | 🔒 |
/loot | Generates loot | /loot give @p loot ... | ✅ | ✅ | 🔒 |
/item | Manages items | /item replace entity @p ... | ✅ | ❌ | 🔒 |
/fillbiome | Changes the biome | /fillbiome ... cherry_grove | ✅ | ❌ | 🔒 |
Building Commands Details
/setblock — Place a block
Places a specific block at a position.
/setblock <x> <y> <z> <block> [mode]
| Mode | Effect |
|---|---|
replace | Replaces everything (default) |
destroy | Destroys the old block (drops) |
keep | Only replaces air |
Examples:
/setblock ~ ~-1 ~ minecraft:glass
/setblock 100 64 100 diamond_block destroy
/setblock ~ ~ ~ air destroy
/fill — Fill an area
Fills a cubic area with a block.
/fill <x1> <y1> <z1> <x2> <y2> <z2> <block> [mode]
| Mode | Effect |
|---|---|
replace | Replaces everything |
destroy | Destroys and drops |
keep | Only replaces air |
hollow | Hollow cube (interior = air) |
outline | Only outlines |
replace <old> | Replaces a specific type |
Examples:
/fill ~ ~ ~ ~10 ~10 ~10 stone hollow
/fill 0 0 0 100 50 100 air replace water
/fill ~ ~-1 ~ ~20 ~-1 ~20 grass_block
Limit: Maximum 32,768 blocks per command.
/clone — Copy an area
Copies a region to another destination.
/clone <x1> <y1> <z1> <x2> <y2> <z2> <dest_x> <dest_y> <dest_z> [mode]
| Mode | Effect |
|---|---|
replace | Copies everything |
masked | Ignores air blocks |
filtered <block> | Copies only that block |
move | Moves (clears the source) |
Examples:
/clone 0 64 0 10 74 10 100 64 100
/clone ~ ~ ~ ~10 ~10 ~10 ~20 ~ ~ masked
Entities and Mobs Commands
Manage creatures with these Minecraft commands.
| Command | Description | Example | Java | Bedrock | Operator |
|---|---|---|---|---|---|
/summon | Summons an entity | /summon zombie ~ ~ ~ | ✅ | ✅ | 🔒 |
/kill | Kills entities | /kill @e[type=!player] | ✅ | ✅ | 🔒 |
/tp | Teleports entities | /tp @e[type=cow] @p | ✅ | ✅ | 🔒 |
/effect | Effects on entities | /effect give @e[type=zombie] ... | ✅ | ✅ | 🔒 |
/tag | Tag entities | /tag @e[type=pig] add marked | ✅ | ✅ | 🔒 |
/data | Modify NBT | /data merge entity @e ... | ✅ | ❌ | 🔒 |
/damage | Inflict damage | /damage @p 5 magic | ✅ | ✅ | 🔒 |
/ride | Ride entities | /ride @p start_riding @e... | ✅ | ✅ | 🔒 |
/bossbar | Boss bars | /bossbar add mon_boss "Boss" | ✅ | ❌ | 🔒 |
/event | Entity events | /event entity @e ... | ❌ | ✅ | 🔒 |
Entity Selectors
Selectors are essential for targeting entities.
| Selector | Target |
|---|---|
@p | Nearest player |
@a | All players |
@r | Random player |
@e | All entities |
@s | Command executor |
Common Filters:
| Filter | Example | Effect |
|---|---|---|
type | @e[type=zombie] | Only zombies |
distance | @e[distance=..10] | Within a 10-block radius |
limit | @e[limit=1] | One entity only |
sort | @e[sort=nearest] | Sort by nearest |
tag @e[tag=boss] With the "boss" tag name @e[name="Steve"] Named "Steve" Entity Commands Details
/summon — Summon
Spawns an entity.
/summon <entity> [x] [y] [z] [nbt]
| Example | Result |
|---|---|
/summon zombie | Zombie at your position |
/summon creeper ~ ~ ~ {Fuse:0} | Creeper that explodes immediately |
/summon horse ~ ~ ~ {Tame:1b} | Tamed horse |
/summon lightning_bolt | Lightning bolt |
/summon item ~ ~ ~ {Item:{id:"diamond",Count:64}} | 64 diamonds on the ground |
/kill — Kill
Kills targeted entities.
/kill <target>
| Command | Effect |
|---|---|
/kill @e | Kills EVERYTHING (including you!) |
/kill @e[type=!player] | Kills everything except players |
/kill @e[type=item] | Removes items on the ground |
/kill @e[type=zombie,distance=..50] | Zombies within 50 blocks |
/kill @e[type=experience_orb] | Removes XP orbs |
/tag — Tag
Adds custom tags to entities.
/tag <target> add <name>
/tag <target> remove <name>
/tag <target> list
Usage :
/tag @e[type=pig,limit=1] add special
/kill @e[tag=special]
Server Administration Commands
Manage your server with these Minecraft commands.
| Command | Description | Example | Java | Bedrock | Operator |
|---|---|---|---|---|---|
/op | Give operator | /op Steve | ✅ | ✅ | 🔒 |
/deop | Remove operator | /deop Steve | ✅ | ✅ | 🔒 |
/kick | Kick player | /kick Steve Reason | ✅ | ✅ | 🔒 |
/ban | Ban player | /ban Steve Cheating | ✅ | ❌ | 🔒 |
/pardon | Unban | /pardon Steve | ✅ | ❌ | 🔒 |
/ban-ip | Ban IP | /ban-ip 192.168.1.1 | ✅ | ❌ | 🔒 |
/pardon-ip | Unban IP | /pardon-ip 192.168.1.1 | ✅ | ❌ | 🔒 |
/banlist | Ban list | /banlist | ✅ | ❌ | 🔒 |
/whitelist | Whitelist | /whitelist add Steve | ✅ | ❌ | 🔒 |
/allowlist | Allow list | /allowlist add Steve | ❌ | ✅ | 🔒 |
/list | Connected players | /list | ✅ | ✅ | 🔓 |
/stop | Stop server | /stop | ✅ | ✅ | 🔒 |
/save-all | Save all | /save-all | ✅ | ❌ | 🔒 |
/save-on | Enable saves | /save-on | ✅ | ❌ | 🔒 |
/save-off | Disable saves | /save-off | ✅ | ❌ | 🔒 |
/setidletimeout | AFK timeout | /setidletimeout 10 | ✅ | ❌ | 🔒 |
/setmaxplayers | Players limit | /setmaxplayers 20 | ❌ | ✅ | 🔒 |
/opreload | Reload ops | /opreload | ❌ | ✅ | 🔒 |
Administration Details
/whitelist and /allowlist
Manages the list of authorized players.
| Command | Effect |
|---|---|
/whitelist on | Enable whitelist |
/whitelist off | Disable |
/whitelist add Steve | Allow Steve |
/whitelist remove Steve | Remove Steve |
/whitelist list | Show the list |
/whitelist reload | Reload from file |
Communication Commands
Communicate with these Minecraft commands.
| Command | Description | Example | Java | Bedrock | Operator |
|---|---|---|---|---|---|
/say | Public message | /say Welcome! | ✅ | ✅ | 🔒 |
/tell | Private message | /tell Steve Hi | ✅ | ✅ | 🔓 |
/msg | /tell alias | /msg Steve Hello | ✅ | ✅ | 🔓 |
/w | /tell alias | /w Steve Hi | ✅ | ✅ | 🔓 |
/me | Roleplay action | /me dances | ✅ | ✅ | 🔓 |
/teammsg | Team message | /teammsg Let's attack! | ✅ | ❌ | 🔓 |
/tm | /teammsg alias | /tm Ready? | ✅ | ❌ | 🔓 |
/tellraw | JSON Message | /tellraw @a {"text":"Hi"} | ✅ | ✅ | 🔒 |
/title | Screen Title | /title @a title "Victory" | ✅ | ✅ | 🔒 |
/titleraw | JSON Title | /titleraw @a title {...} | ❌ | ✅ | 🔒 |
/help | Commands Help | /help gamemode | ✅ | ✅ | 🔓 |
Communication Details
/title — Display a Title
Displays a large title on the screen.
/title <target> <title|subtitle|actionbar> <text>
/title <target> times <fadeIn> <stay> <fadeOut>
/title <target> clear
| Command | Effect |
|---|---|
/title @a title "Welcome" | Main Title |
/title @a subtitle "Have fun" | Subtitle |
/title @a actionbar "Score: 100" | Action Bar |
/title @a times 20 60 20 | Durations (ticks) |
Example with JSON formatting :
/title @a title {"text":"VICTORY","color":"gold","bold":true}
/tellraw — Formatted Message
Sends a message with advanced JSON formatting.
/tellraw <target> <json>
| Property | Values |
|---|---|
text | The text to display |
color | red, green, blue, gold, etc. |
bold | true/false |
italic | true/false |
underlined | true/false |
clickEvent | Click actions |
Example :
/tellraw @a {"text":"Click here","color":"green","clickEvent":{"action":"run_command","value":"/tp @s 0 100 0"}}
Scoreboard Commands and Objectives
Scoring system with these Minecraft commands.
| Command | Description | Example | Java | Bedrock | Operator |
|---|---|---|---|---|---|
/scoreboard | Scores management | /scoreboard objectives add ... | ✅ | ✅ | 🔒 |
/team | Teams management | /team add Red | ✅ | ❌ | 🔒 |
/trigger | Trigger objective | /trigger my_objective add 1 | ✅ | ❌ | 🔓 |
/advancement | Progress/Achievements | /advancement grant @p everything | ✅ | ❌ | 🔒 |
/recipe | Recipes | /recipe give @p * | ✅ | ✅ | 🔒 |
Scoreboard Details
/scoreboard — Complete System
Manages the scoreboard.
Objectives :
/scoreboard objectives add <name> <criteria> [display]
/scoreboard objectives remove <name>
/scoreboard objectives setdisplay <slot> <objective>
| Criteria | Description |
|---|---|
dummy | Only modifiable by commands |
deathCount | Number of deaths |
playerKillCount | Players killed |
totalKillCount | Entities killed |
health | Health points |
xp | Experience points |
level | XP level |
Players :
/scoreboard players set <player> <objective> <score>
/scoreboard players add <player> <objective> <value>
/scoreboard players remove <player> <objective> <value>
/scoreboard players reset <player>
Complete Example :
/scoreboard objectives add Kills playerKillCount "Eliminations"
/scoreboard objectives setdisplay sidebar Kills
/scoreboard players set Steve Kills 10
/team — Teams (Java)
Creates and manages teams.
/team add <name> [display]
/team remove <name>
/team join <team> <players>
/team leave <players>
/team modify <team> <option> <value>
| Option | Values |
|---|---|
color | red, blue, green, etc. |
friendlyFire | true/false |
seeFriendlyInvisibles | true/false |
nametagVisibility | always, never, hideForOtherTeams |
collisionRule | always, never, pushOtherTeams |
Example :
/team add Red
/team modify Red color red
/team join Red Steve Alex
Advanced Technical Commands
Minecraft commands for experts and map creators.
| Command | Description | Example | Java | Bedrock | Operator |
|---|---|---|---|---|---|
/execute | Conditional execution | /execute as @a run say Hi | ✅ | ✅ | 🔒 |
/function | Execute functions | /function namespace:file | ✅ | ✅ | 🔒 |
/schedule | Schedule execution | /schedule function ... 10s | ✅ | ✅ | 🔒 |
/data | Modify NBT | /data get entity @p | ✅ | ❌ | 🔒 |
/datapack | Manage datapacks | /datapack list | ✅ | ❌ | 🔒 |
/reload | Reload resources | /reload | ✅ | ✅ | 🔒 |
/seed | Show seed | /seed | ✅ | ❌ | 🔓 |
/debug Debug mode /debug start ✅ ❌ 🔒 /perf Performance /perf start ✅ ❌ 🔒 /publish Open in LAN /publish ✅ ❌ 🔓 /playsound Play a sound /playsound ... master @p ✅ ✅ 🔒 /stopsound Stop a sound /stopsound @a ✅ ✅ 🔒 /music Control music /music play ... ❌ ✅ 🔒 /camerashake Shake camera /camerashake add @p 1 5 ❌ ✅ 🔒 /playanimation Play animation /playanimation @e ... ❌ ✅ 🔒 Technical Details
/execute — The most powerful
Executes commands with conditions and context.
Java Syntax 1.13+ :
/execute <sub-commands> run <command>
| Sub-command | Effect |
|---|---|
as <entity> | Execute as the entity |
at <entity> | Execute at the entity's position |
positioned <x y z> | Execute at this position |
if block <x y z> <block> | If the block exists |
if entity <target> | If the entity exists |
if score <target> <obj> ... | If the score matches |
unless ... | Opposite of if |
store result ... | Store the result |
Examples :
/execute as @e[type=zombie] at @s run summon lightning_bolt ~ ~ ~
/execute if block ~ ~-1 ~ diamond_block run say Diamond!
/execute as @a at @s if block ~ ~-1 ~ lava run kill @s
/execute positioned 0 100 0 run summon tnt
/data — NBT Manipulation (Java)
Reads and modifies NBT data.
/data get <block|entity> <target> [path]
/data merge <block|entity> <target> <nbt>
/data modify <target> <path> <operation> ...
/data remove <target> <path>
Examples :
/data get entity @p Inventory
/data merge entity @e[type=creeper,limit=1] {Fuse:0}
/data modify entity @p Inventory[0].Count set value 64
/function — Functions
Executes a .mcfunction file from a datapack.
/function <namespace>:<path>
Example :
/function mypack:setup/init
/function minecraft:tick
/schedule — Delayed Execution
Schedules the future execution of a function.
/schedule function <function> <time> [append|replace]
/schedule clear <function>
| Time | Equivalent |
|---|---|
10t | 10 ticks (0.5s) |
5s | 5 seconds |
1d | 1 Minecraft day |
Obsolete Minecraft Commands
These commands have been removed or replaced.
| Old Command | Removed Version | Replaced by |
|---|---|---|
/testfor | Java 1.13 | /execute if entity |
/testforblock | Java 1.13 | /execute if block |
/testforblocks | Java 1.13 | /execute if blocks |
/blockdata | Java 1.13 | /data merge block |
/entitydata | Java 1.13 | /data merge entity |
/replaceitem | Java 1.17 | /item replace |
/achievement | Java 1.12 | /advancement |
/toggledownfall | Java 1.13 | /weather |
/stats | Java 1.13 | /execute store |
FAQ on Minecraft Commands
How to enable Minecraft commands?
In single player, check "Allow Cheats" when creating the world. On a server, type /op <your_username> in the console.
What is the command to keep inventory?
/gamerule keepInventory true
How to teleport in Minecraft?
/tp <username> <x> <y> <z>
Example: /tp Steve 100 64 200
How to switch to creative mode?
/gamemode creative
How to summon a mob?
/summon <mob_type>
Example: /summon minecraft:wither
How to find a village?
/locate structure village
How to change time to day?
/time set day
Conclusion
This comprehensive guide to Minecraft commands covers all the possibilities offered by Java Edition and Bedrock Edition, categorized by importance and presented in tables for quick reference.
Summary of the most useful commands :
| Need | Command |
|---|---|
| Change mode | /gamemode creative |
| Teleport | /tp @p <x> <y> <z> |
| Keep inventory | /gamerule keepInventory true |
| Change time | /time set day |
| Stop rain | /weather clear |
| Get items | /give @p <item> <quantity> |
| Summon a mob | /summon <entity> |
| Find a structure | /locate structure <name> |
Feel free to experiment and consult official wikis for more advanced use cases!


