/execute

Cheats / op 2Java 26.3

Runs another command as a different entity, at another position or only when conditions are met. Its basic form is /execute if biome <pos> <biome>; it has 17 syntax forms and 27 arguments. Permission: Cheats / op 2.

Who can use it
Cheats / op 2
Syntax forms
17
Arguments
27

/execute syntax

Game data

Every form the game accepts. Words in <angle brackets> are arguments you fill in; everything else is typed as is.

/execute if biome <pos> <biome>
/execute if block <pos> <block>
/execute if blocks <start> <end> <destination> all
/execute if blocks <start> <end> <destination> masked
/execute if data block <source> <path>
/execute if data entity <source> <path>
/execute if data storage <source> <path>
/execute if dimension <dimension>
/execute if entity <entities>
/execute if items block <source> <slots> <item_predicate>
/execute if items entity <source> <slots> <item_predicate>
/execute if loaded <pos>
/execute if predicate <predicate>
/execute if score <target> <targetObjective> < <source> <sourceObjective>
/execute if score <target> <targetObjective> <= <source> <sourceObjective>
/execute if score <target> <targetObjective> = <source> <sourceObjective>
/execute if score <target> <targetObjective> > <source> <sourceObjective>

Some branches continue into another command's syntax (shown with …), like /execute's run.

/execute examples

Ready-to-paste examples (cheats on). @s is you, @p the nearest player, @a everyone, @e every entity.

/execute as @a at @s run summon minecraft:firework_rocket ~ ~1 ~
Launches a firework above every player.
/execute if block ~ ~-1 ~ minecraft:gold_block run say Gold!
Says "Gold!" if you stand on a gold block.

/execute arguments

What each argument expects, with the limits the game enforces.

/execute arguments
ArgumentExpectsLimits
<axes>Axes (any of x, y, z)—
<anchor>eyes or feet—
<targets>Target selector or player name (@s, @p, @a, @e, @r)one or more
<pos>Position (x y z, decimals allowed)—
<biome>Game ID or #tagworldgen/biome
<block>Block ID or #tag, with optional [states]—
<start>Block coordinates (x y z, ~ relative, ^ local)—
<end>Block coordinates (x y z, ~ relative, ^ local)—
<destination>Block coordinates (x y z, ~ relative, ^ local)—
<source>Block coordinates (x y z, ~ relative, ^ local)—
<path>NBT path—
<dimension>Dimension (minecraft:overworld, the_nether, the_end)—
<entities>Target selector or player name (@s, @p, @a, @e, @r)one or more
<name>Function ID or #tag—
<slots>Slot source—
<item_predicate>Item ID or #tag, with optional components—
<predicate>Predicate ID—
<target>Score holder (selector, name or *)one target
<targetObjective>Scoreboard objective name—
<sourceObjective>Scoreboard objective name—
<range>Number range (e.g. 1..5)—
<id>Namespaced ID (minecraft:…)—
<heightmap>Heightmap type—
<rot>Rotation (yaw pitch)—
<scale>Number—
<objective>Scoreboard objective name—
<entity>Game ID from a registryentity_type

Related commands

Data: Minecraft Java Edition 26.3 game files. How we source this

Runs another command as a different entity, at another position or only when conditions are met. It has 17 syntax forms and can be run by: Cheats / op 2.

See Also

🔍

Help us maintain accuracy! If you notice incorrect stats, missing data, or any issues, your feedback directly improves the quality of our data for the entire community.

Report an Issue

/execute FAQ (Java 26.3)

What does /execute do in Minecraft?

Runs another command as a different entity, at another position or only when conditions are met.

What is the syntax of /execute?

The basic form is /execute if biome <pos> <biome>. All forms are listed above.

What is an example of /execute?

/execute as @a at @s run summon minecraft:firework_rocket ~ ~1 ~ — Launches a firework above every player.

Do you need cheats for /execute?

Yes: Cheats / op 2. In singleplayer turn on Allow Cheats (or open to LAN with cheats).