Minecraft /execute command generator
Build a /execute chain visually. It is the most powerful command in Minecraft Java Edition. Add subcommands, reorder them and copy the finished result.
1Add subcommands
2Command chain (0)
3Generated command
?Tips
@a = all players, @p = nearest player, @s = the executor, @e = all entities, @r = random player@e[type=zombie,distance=..10] selects all zombies within 10 blocksas, then at, then conditions, and finish with run. Each subcommand changes the context for the next one.What /execute does
/execute is the most powerful and versatile command in Minecraft Java Edition (since version 1.13). It lets you run any command in a specific context: as a particular entity, at a particular position, under certain conditions and in any dimension. A /execute chain is made of subcommands that modify the execution context one after another, and a final run runs the actual command.
The command is the foundation of advanced mechanics in adventure maps, minigames and on servers. With it you can, for example, kill all zombies within 10 blocks of every player, teleport players standing on a particular block, or run a chain of commands only when a condition is met.
/execute subcommands
Changes the executor of the command (changes @s). The command runs once for each matching entity.
Changes the execution position, rotation and dimension to those of the given entity. Does not change the executor (@s).
Sets the execution position to the given coordinates. Supports ~ (relative) and ^ (local).
Condition: continue only if an entity matching the selector exists.
Inverse condition: continue only if NO entity matching the selector exists.
Condition: continue if the given block is at the given position.
Rotates the execution context to face the given position.
Changes the execution dimension (overworld, the_nether, the_end).
Runs the actual command in the current context. Always last in the chain.
Usage examples
/execute as @a at @s run kill @e[type=zombie,distance=..20] /execute as @a at @s if block ~ ~-1 ~ minecraft:gold_block run give @s minecraft:diamond 1 /execute as @a at @s if entity @e[type=creeper,distance=..5] run title @s actionbar "Watch out! Creeper nearby!" Frequently asked questions
Does /execute work in Bedrock Edition?
Bedrock Edition has its own version of /execute, with different syntax and fewer subcommands. This generator produces syntax for Java Edition 1.13+. Some subcommands (such as "rotated" and "facing") may not exist in Bedrock.
Does the order of subcommands matter?
Yes. Each subcommand modifies the context for the next one. For example, "as @a at @s" means: for each player, at their position. If you swapped it to "at @s as @a", "at" would use the position of the original executor (a command block), and "as" would then select the players. The result would be different.
Can I use multiple if/unless conditions?
Yes, you can chain several conditions, and all of them must be met (they work like AND). For example, if entity @e[type=zombie] if block ~ ~-1 ~ stone: run if there is a zombie AND the player is standing on stone.