align anchored as at facing if in on positioned rotated run store summon unless Examples FAQ /execute align
/execute align <axes> …Copy
Argument Expects What it does axes Axes (xyz) Axes rounded down to whole blocks, in any order: x, xz or xyz.
/execute anchored
/execute anchored <anchor> …Copy
Argument Expects What it does anchor eyes / feet eyes or feet: the point that local coordinates ^ ^ ^ and facing start from.
/execute as
/execute as <targets> …Copy
Argument Expects What it does targets Entity selectorone or several Entities that become the executor (@s). The rest of the chain runs once per entity.
/execute at
/execute at <targets> …Copy
Argument Expects What it does targets Entity selectorone or several Entities whose position, rotation and dimension are used. The executor does not change.
/execute facing
/execute facing (entity|<pos> )Copy
Argument Expects What it does targets Entity selectorone or several Entity to face; the anchor that follows picks its eyes or its feet. anchor eyes / feet eyes or feet: the point that local coordinates ^ ^ ^ and facing start from. pos Position (x y z) Coordinates, absolute (0 64 0), relative (~ ~1 ~) or local (^ ^ ^2).
All 2 forms /execute facing entity <targets> <anchor> … /execute facing <pos> … /execute if
/execute if (biome|block|blocks|data|dimension|entity|function|items|loaded|predicate|score|slots|stopwatch)Copy
Argument Expects What it does pos Block coordinates (x y z) Block coordinates to test, for example ~ ~-1 ~ for the block under the executor. biome ID or #tag · biome Biome ID or biome tag to test, for example minecraft:plains or #minecraft:is_ocean. block Block test Block to look for, with optional states or a tag, for example minecraft:chest or #minecraft:logs. start Block coordinates (x y z) First corner of the area that is compared. end Block coordinates (x y z) Opposite corner of the area that is compared. destination Block coordinates (x y z) Lower north-west corner of the second area, the one it is compared with. source Block coordinates (x y z) What to read: block coordinates, an entity, a storage ID or a score holder, depending on the keyword before it. path NBT path NBT path to test, such as Inventory[0] or Health. The test passes if the path exists. dimension Dimension Dimension ID: minecraft:overworld, minecraft:the_nether or minecraft:the_end. entities Entity selectorone or several Selector to test. The check passes if at least one entity matches. name Function Function or function tag to run. The test passes if it returns a value other than 0. slots Slots Slot or range of slots, for example weapon.mainhand, armor.head or container.*. item_predicate Item test Item to look for: an ID, a tag, * for any item, or an ID with component checks. predicate Predicate ID of a predicate file from a data pack, for example mypack:is_night. target Score holderone Score holder whose score is tested: @s, a player name or a fake name. targetObjective Scoreboard objective Objective that holds the score being tested. sourceObjective Scoreboard objective Objective of the score it is compared with. range Range (1..5) Accepted values: 5 exactly, 1..10 between, 10.. at least, ..3 at most. For stopwatches, in seconds. id Resource ID ID of the stopwatch to test, created with /stopwatch create.
All 45 forms /execute if biome <pos> <biome> /execute if biome <pos> <biome> … /execute if block <pos> <block> /execute if block <pos> <block> … /execute if blocks <start> <end> <destination> all /execute if blocks <start> <end> <destination> all … /execute if blocks <start> <end> <destination> masked /execute if blocks <start> <end> <destination> masked … /execute if data block <source> <path> /execute if data block <source> <path> … /execute if data entity <source> <path> /execute if data entity <source> <path> … /execute if data storage <source> <path> /execute if data storage <source> <path> … /execute if dimension <dimension> /execute if dimension <dimension> … /execute if entity <entities> /execute if entity <entities> … /execute if function <name> … /execute if items block <source> <slots> <item_predicate> /execute if items block <source> <slots> <item_predicate> … /execute if items entity <source> <slots> <item_predicate> /execute if items entity <source> <slots> <item_predicate> … /execute if loaded <pos> /execute if loaded <pos> … /execute if predicate <predicate> /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> … /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> … /execute if score <target> <targetObjective> >= <source> <sourceObjective> /execute if score <target> <targetObjective> >= <source> <sourceObjective> … /execute if score <target> <targetObjective> matches <range> /execute if score <target> <targetObjective> matches <range> … /execute if slots block <source> <slots> /execute if slots block <source> <slots> … /execute if slots entity <source> <slots> /execute if slots entity <source> <slots> … /execute if stopwatch <id> <range> /execute if stopwatch <id> <range> … /execute in
/execute in <dimension> …Copy
Argument Expects What it does dimension Dimension Dimension ID: minecraft:overworld, minecraft:the_nether or minecraft:the_end.
/execute onAdded in 1.19.4
/execute on (attacker|controller|leasher|origin|owner|passengers|target|vehicle)Copy
All 8 forms /execute on attacker … /execute on controller … /execute on leasher … /execute on origin … /execute on owner … /execute on passengers … /execute on target … /execute on vehicle … /execute positioned
/execute positioned (as|over|<pos> )Copy
Argument Expects What it does targets Entity selectorone or several Entity whose position is used, without its rotation or its dimension. heightmap Heightmap Heightmap that sets the height: world_surface, motion_blocking, motion_blocking_no_leaves or ocean_floor. pos Position (x y z) Coordinates, absolute (0 64 0), relative (~ ~1 ~) or local (^ ^ ^2).
All 3 forms /execute positioned as <targets> … /execute positioned over <heightmap> … /execute positioned <pos> … /execute rotated
/execute rotated (as|<rot> )Copy
Argument Expects What it does targets Entity selectorone or several Entity whose rotation is used, without moving the current position. rot Rotation (yaw pitch) Rotation as yaw and pitch, for example 90 0, or ~ ~ for relative values.
All 2 forms /execute rotated as <targets> … /execute rotated <rot> … /execute store
/execute store (result|success)Copy
Argument Expects What it does target Block coordinates (x y z) Where the value goes: block coordinates, an entity or a storage ID, depending on the keyword. path NBT path NBT path that receives the value, followed by its type: byte, short, int, long, float or double. scale Number Multiplier applied before the value is stored, for example 0.01 or 100. id Resource ID ID of the bossbar whose value or max receives the result. targets Score holderone or several Score holders that receive the value: @s, @a, a player name or a fake name. objective Scoreboard objective Objective that receives the stored value.
All 42 forms /execute store result block <target> <path> byte <scale> … /execute store result block <target> <path> double <scale> … /execute store result block <target> <path> float <scale> … /execute store result block <target> <path> int <scale> … /execute store result block <target> <path> long <scale> … /execute store result block <target> <path> short <scale> … /execute store result bossbar <id> max … /execute store result bossbar <id> value … /execute store result entity <target> <path> byte <scale> … /execute store result entity <target> <path> double <scale> … /execute store result entity <target> <path> float <scale> … /execute store result entity <target> <path> int <scale> … /execute store result entity <target> <path> long <scale> … /execute store result entity <target> <path> short <scale> … /execute store result score <targets> <objective> … /execute store result storage <target> <path> byte <scale> … /execute store result storage <target> <path> double <scale> … /execute store result storage <target> <path> float <scale> … /execute store result storage <target> <path> int <scale> … /execute store result storage <target> <path> long <scale> … /execute store result storage <target> <path> short <scale> … /execute store success block <target> <path> byte <scale> … /execute store success block <target> <path> double <scale> … /execute store success block <target> <path> float <scale> … /execute store success block <target> <path> int <scale> … /execute store success block <target> <path> long <scale> … /execute store success block <target> <path> short <scale> … /execute store success bossbar <id> max … /execute store success bossbar <id> value … /execute store success entity <target> <path> byte <scale> … /execute store success entity <target> <path> double <scale> … /execute store success entity <target> <path> float <scale> … /execute store success entity <target> <path> int <scale> … /execute store success entity <target> <path> long <scale> … /execute store success entity <target> <path> short <scale> … /execute store success score <targets> <objective> … /execute store success storage <target> <path> byte <scale> … /execute store success storage <target> <path> double <scale> … /execute store success storage <target> <path> float <scale> … /execute store success storage <target> <path> int <scale> … /execute store success storage <target> <path> long <scale> … /execute store success storage <target> <path> short <scale> … /execute summonAdded in 1.19.4
/execute summon <entity> …Copy
Argument Expects What it does entity ID · entity_type Entity type to summon, for example minecraft:armor_stand or minecraft:marker.
/execute unless
/execute unless (biome|block|blocks|data|dimension|entity|function|items|loaded|predicate|score|slots|stopwatch)Copy
Argument Expects What it does pos Block coordinates (x y z) Block coordinates to test, for example ~ ~-1 ~ for the block under the executor. biome ID or #tag · biome Biome ID or biome tag to test, for example minecraft:plains or #minecraft:is_ocean. block Block test Block to look for, with optional states or a tag, for example minecraft:chest or #minecraft:logs. start Block coordinates (x y z) First corner of the area that is compared. end Block coordinates (x y z) Opposite corner of the area that is compared. destination Block coordinates (x y z) Lower north-west corner of the second area, the one it is compared with. source Block coordinates (x y z) What to read: block coordinates, an entity, a storage ID or a score holder, depending on the keyword before it. path NBT path NBT path to test, such as Inventory[0] or Health. The test passes if the path exists. dimension Dimension Dimension ID: minecraft:overworld, minecraft:the_nether or minecraft:the_end. entities Entity selectorone or several Selector to test. The check passes if at least one entity matches. name Function Function or function tag to run. The test passes if it returns a value other than 0. slots Slots Slot or range of slots, for example weapon.mainhand, armor.head or container.*. item_predicate Item test Item to look for: an ID, a tag, * for any item, or an ID with component checks. predicate Predicate ID of a predicate file from a data pack, for example mypack:is_night. target Score holderone Score holder whose score is tested: @s, a player name or a fake name. targetObjective Scoreboard objective Objective that holds the score being tested. sourceObjective Scoreboard objective Objective of the score it is compared with. range Range (1..5) Accepted values: 5 exactly, 1..10 between, 10.. at least, ..3 at most. For stopwatches, in seconds. id Resource ID ID of the stopwatch to test, created with /stopwatch create.
All 45 forms /execute unless biome <pos> <biome> /execute unless biome <pos> <biome> … /execute unless block <pos> <block> /execute unless block <pos> <block> … /execute unless blocks <start> <end> <destination> all /execute unless blocks <start> <end> <destination> all … /execute unless blocks <start> <end> <destination> masked /execute unless blocks <start> <end> <destination> masked … /execute unless data block <source> <path> /execute unless data block <source> <path> … /execute unless data entity <source> <path> /execute unless data entity <source> <path> … /execute unless data storage <source> <path> /execute unless data storage <source> <path> … /execute unless dimension <dimension> /execute unless dimension <dimension> … /execute unless entity <entities> /execute unless entity <entities> … /execute unless function <name> … /execute unless items block <source> <slots> <item_predicate> /execute unless items block <source> <slots> <item_predicate> … /execute unless items entity <source> <slots> <item_predicate> /execute unless items entity <source> <slots> <item_predicate> … /execute unless loaded <pos> /execute unless loaded <pos> … /execute unless predicate <predicate> /execute unless predicate <predicate> … /execute unless score <target> <targetObjective> < <source> <sourceObjective> /execute unless score <target> <targetObjective> < <source> <sourceObjective> … /execute unless score <target> <targetObjective> <= <source> <sourceObjective> /execute unless score <target> <targetObjective> <= <source> <sourceObjective> … /execute unless score <target> <targetObjective> = <source> <sourceObjective> /execute unless score <target> <targetObjective> = <source> <sourceObjective> … /execute unless score <target> <targetObjective> > <source> <sourceObjective> /execute unless score <target> <targetObjective> > <source> <sourceObjective> … /execute unless score <target> <targetObjective> >= <source> <sourceObjective> /execute unless score <target> <targetObjective> >= <source> <sourceObjective> … /execute unless score <target> <targetObjective> matches <range> /execute unless score <target> <targetObjective> matches <range> … /execute unless slots block <source> <slots> /execute unless slots block <source> <slots> … /execute unless slots entity <source> <slots> /execute unless slots entity <source> <slots> … /execute unless stopwatch <id> <range> /execute unless stopwatch <id> <range> … Examples Speed boost on gold blocks /execute as @a at @s if block ~ ~-1 ~ minecraft:gold_block run effect give @s minecraft:speed 5 1 trueCopy
Every player standing on a Block of Gold gets Speed II for 5 seconds, without particles. Put it in a repeating command block.
Java 26.3
Warn players about nearby zombies /execute as @a at @s if entity @e[type=minecraft:zombie,distance=..8] run title @s actionbar {"text":"Zombie nearby!","color":"red"}Copy
Each player with a zombie within 8 blocks sees a red warning above the hotbar.
Java 26.3
Tag players with 10 kills /execute as @a if score @s kills matches 10.. run tag @s add veteranCopy
Adds the veteran tag to every player whose kills score is 10 or more.
Java 26.3
Give a compass to those without one /execute as @a[gamemode=adventure] unless items entity @s container.* minecraft:compass run give @s minecraft:compassCopy
Players in Adventure mode who carry no compass in their inventory receive one.
Java 26.3
Save a player's height in a score /execute as @p store result score @s y_pos run data get entity @s Pos[1]Copy
Copies the Y coordinate of the nearest player into the y_pos score as a whole number. The objective must exist.
Java 26.3
Count all loaded zombies /execute store result score zombie_count stats if entity @e[type=minecraft:zombie]Copy
Stores the number of zombies in loaded chunks in the fake holder zombie_count of the stats objective.
Java 26.3
Particle five blocks ahead /execute as @p at @s anchored eyes positioned ^ ^ ^5 run particle minecraft:flame ~ ~ ~Copy
Shows a flame 5 blocks in front of the nearest player's eyes, in the direction they are looking.
Java 26.3
Teleport into the Nether /execute in minecraft:the_nether run teleport @s 0 100 0Copy
Sends you to X 0, Y 100, Z 0 in the Nether. Check the spot first: you may land inside netherrack.
Java 26.3
Build your command Fill in the fields, then copy the command.
Command generator How the chain works /execute reads its subcommands from left to right, and each one changes the context for everything that follows. run always comes last and is followed by an ordinary command without a slash. as changes the executor, so @s now points to that entity, but the position stays where it was. at takes the position, rotation and dimension of the entity without changing the executor. That is why execute as @a at @s is the usual opening: each player runs the command at their own feet. positioned, rotated, facing, anchored, align and in fine-tune the context. When a selector finds several entities, the rest of the chain runs once for each of them.
Conditions and stored results if and unless stop the branch when the test fails. They can check blocks, entities, scores, NBT data, items, biomes, dimensions, predicates, functions and stopwatches. Without run, the command only reports "Test passed" or "Test failed", with a count for entities. store result and store success write the outcome of the final command into a /scoreboard score, entity or block NBT, a storage or a bossbar. Combine it with /data to turn NBT values into scores.
Tips summon creates an entity and makes it the executor at once; on owner, on vehicle or on attacker jump to a related entity.In a Repeating Command Block or a tick function, narrow selectors such as @e[type=zombie,distance=..10] to keep the game fast. Long chains are easier to read in a /function file. ✓ Checked in Java Edition 26.3 · updated 2 November 2026
/execute: FAQ Why does /execute as @a not use the player's position? as only changes who runs the command. Add at @s right after it so the position moves to each player too.
Can /execute run several commands at once? No, run accepts a single command. Put the commands in a function and use run function: it keeps the executor and the position.
How do I use /execute? Type it in the chat with cheats on: /execute align <axes> ….
Who can use /execute? Cheats on, or operator level 2.