Skip to main content

/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.

Category
Execute
Permission Level
Game Master
Version Added
1.13

Overview

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. In vanilla Minecraft Java Edition it is one of the execute commands and has been available since version 1.13.

It is invoked as /execute ... run and accepts 2 required arguments ( and ).

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.

Subcommands chain to reshape context before a final 'run': 'as' changes who runs the command, 'at' changes position/rotation/dimension, 'positioned'/'rotated'/'facing' adjust placement, 'in' changes dimension, 'if'/'unless' add conditions and 'store' writes the result to a scoreboard, data path or bossbar.

Syntax & Arguments

/execute <subcommand> ... run <command>

The full syntax is /execute ... run . Angle brackets < > mark required arguments and square brackets [ ] mark optional ones; a vertical bar | between words means you pick exactly one of those literals. You must always supply and .

subcommands
Required, of type a various. Chain of subcommands: as, at, positioned, rotated, facing, anchored, align, in, if/unless, store, on, summon, run.
command
Required, of type a command. The command to execute with the modified context (after 'run').

Parameters

NameTypeRequiredDescription
subcommandsvariousRequiredChain of subcommands: as, at, positioned, rotated, facing, anchored, align, in, if/unless, store, on, summon, run.
commandcommandRequiredThe command to execute with the modified context (after 'run').

Examples

The 3 examples below are ready to copy and adapt. For instance, /execute as @a at @s run particle flame ~ ~1 ~ 0.5 0.5 0.5 0 10 spawns flame particles at every player's position by executing as each player at their location. Each example varies the arguments to show a different real use of /execute; read the note under every snippet to see exactly what changes.

/execute as @a at @s run particle flame ~ ~1 ~ 0.5 0.5 0.5 0 10

Spawns 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.

Permission Level & Requirements

/execute sits at permission Level 2 - Game Master / Cheats, which means it needs permission level 2, the level cheats grant to single-player worlds and that operators hold by default.

In a single-player world you must have "Allow Cheats" turned on (or open the world to LAN with cheats) before it will run; on a multiplayer server the player needs to be an operator at the matching level.

This reference describes the Java Edition 1.21 form of the command; Bedrock Edition may use slightly different argument formats.

Common Mistakes

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

If /execute is part of your toolkit, the commands below are the ones you will most often reach for alongside it: /function, /scoreboard, and /data. They cover closely related tasks, so the links above jump straight to each one.

Frequently Asked Questions about /execute

What does the /execute command do in Minecraft?

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. It belongs to the execute command group and was added in Java Edition 1.13.

What is the correct syntax for /execute?

/execute ... run . The required arguments are subcommands and command.

What permission level does /execute need?

It requires permission Level 2 - Game Master / Cheats. On a server the player must be an operator at that level, or have cheats enabled in single-player.

What is a common mistake when using /execute?

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.

Can you give an example of /execute in use?

Yes. /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.

What is the difference between 'as' and 'at' in /execute?

'as ' changes the executor (who the command runs as) but keeps the original position. 'at ' changes the position, rotation and dimension but keeps the original executor. They are frequently combined as 'as @e at @s'.

Need a Minecraft server?

Try these commands on Astroworld or host your own server.

Try Astroworld Hosting