/execute
Modifies the execution context of a command. Supports changing the executor, position, dimension, rotation, anchoring, and adding conditions. The most powerful and flexible command in the game.
Syntax
/execute <subcommand> ... run <command>Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| subcommands | various | Required | Chain of subcommands: as, at, positioned, rotated, facing, anchored, align, in, if/unless, store, on, summon, run. |
| command | command | Required | The command to execute with the modified context (after 'run'). |
Examples
/execute as @a at @s run particle flame ~ ~1 ~ 0.5 0.5 0.5 0 10Spawns flame particles at every player's position by executing as each player at their location.
/execute if score @p kills matches 10.. run title @p title {"text":"Killer!","color":"red"}Shows a "Killer!" title to any nearby player with 10+ kills.
/execute in minecraft:the_nether run tp @s ~ ~ ~Teleports yourself to the same coordinates in the Nether.
Common Mistakes
- Confusing 'as' (changes who) with 'at' (changes where), 'as @a' changes the executor but NOT the position; 'at @a' changes the position but NOT the executor.
- Forgetting the 'run' keyword before the final command, all subcommand chains must end with 'run <command>'.
Notes
Key subcommands: 'as' changes executor, 'at' changes position/rotation/dimension, 'positioned' changes only position, 'in' changes dimension, 'if/unless' adds conditions, 'store' saves results to scoreboards/data/bossbars. Multiple subcommands can be chained for complex logic.
Related Commands
Need a Minecraft server?
Try these commands on Astroworld or host your own server.
Try Astroworld Hosting