Updated 25 October 2026. Facts on this page come from minecraft.wiki, minecraft.net and the live Artemis PvP server; sources are listed at the bottom.

Minecraft /execute Command Explained With Examples
/execute runs another command as a different entity, at a different place, or only if a condition is true, by chaining subcommands and ending with run. For example, /execute as @e[type=zombie] at @s run summon lightning_bolt strikes every zombie. Java has 14 subcommands, Bedrock 11; it needs cheats or operator rights.
What are the parts of /execute?
| Subcommand | What it does | Edition |
|---|---|---|
| as | Runs as each chosen entity (changes who @s is) | Both |
| at | Runs at each chosen entity's position and rotation | Both |
| positioned, rotated, facing, align, anchored | Change position or direction | Both |
| in | Runs in another dimension | Both |
| if / unless | Only continues if a block, entity, score or other test passes | Both |
| on | Switches to a related entity, such as the rider or owner | Java |
| summon | Summons an entity and runs as it | Java |
| store | Saves the result into a score, NBT or a bossbar | Java |
| run | The command to run, always last | Both |
Subcommands are read left to right, so order matters: as @e at @s runs at each entity, while at @s as @e runs every entity at your position.
What are useful /execute examples?
| Command | Result |
|---|---|
/execute as @a at @s run tp ~ ~1 ~ | Lifts every player 1 block |
/execute in minecraft:the_nether run tp @s 0 70 0 | Teleports you to coordinates in the Nether (Java) |
/execute if block ~ ~-1 ~ diamond_block run say on diamond | Runs only if you stand on a diamond block |
/execute as @e[type=zombie] at @s run summon lightning_bolt | Lightning on every zombie |
/execute unless entity @e[type=creeper,distance=..10] run say safe | Runs if no creeper is within 10 blocks (Java) |
Selectors such as @e[type=zombie] are explained in target selectors.
Where is /execute used most?
In command blocks and functions that run every tick: checking where players stand, giving effects in an area, or running minigame logic. Combined with scoreboards it can count kills or time. See command blocks and /scoreboard.
How is it different on Bedrock?
Bedrock got the same newer syntax in 1.19.50 but lacks on, summon and store, and it processes a forked chain depth-first while Java goes breadth-first, so some complex chains act differently. See Bedrock commands.
Which commands can players use on ArtemisPvP?
Frequently asked questions
What does /execute as @a at @s mean?
Run the following command once for each player, at that player's position.
Can /execute change dimension?
Yes, with the in subcommand, for example /execute in minecraft:the_nether run ...
Sources
Every fact on this page was checked against these pages; the wording is ours.