/execute Command in Minecraft Bedrock Edition

Run Commands on Behalf of Entities

Bedrock EditionLogic & ScoreboardPermission: Game DirectorsCheats: YesJava version →

The /execute command in Minecraft Bedrock Edition lets you run a command on behalf of one or more entities. You can chain different clauses together to change who runs the command, where it runs, which direction it faces, and which conditions must be met first.

Players and map makers use this command when building custom mechanics with command blocks. It requires Game Directors permission and cheats must be enabled in your world.

Syntax (18 forms)

  1. /execute as <origin: target> <chainedCommand: executechainedoption_0>

    As another entity

  2. /execute at <origin: target> <chainedCommand: executechainedoption_0>

    At the position of an entity

  3. /execute in <dimension: Dimension> <chainedCommand: executechainedoption_0>

    In dimension

  4. /execute positioned <position: x y z> <chainedCommand: executechainedoption_0>

    Positioned

  5. /execute positioned as <origin: target> <chainedCommand: executechainedoption_0>

    Positioned as a selected entity

  6. /execute rotated <yaw: rotation> <pitch: rotation> <chainedCommand: executechainedoption_0>

    Rotated with a specific yaw/pitch

  7. /execute rotated as <origin: target> <chainedCommand: executechainedoption_0>

    Rotated as a another entity

  8. /execute facing <position: x y z> <chainedCommand: executechainedoption_0>

    Facing a position

  9. /execute facing entity <origin: target> <anchor: ActorLocation> <chainedCommand: executechainedoption_0>

    Facing a selected entity

  10. /execute align <axes: string> <chainedCommand: executechainedoption_0>

    Align

  11. /execute anchored <anchored: ActorLocation> <chainedCommand: executechainedoption_0>

    Anchored

  12. /execute <subcommand: Option_If_Unless> block <position: x y z> <block: Block> [chainedCommand: executechainedoption_0]

    If/unless block matches type

  13. /execute <subcommand: Option_If_Unless> block <position: x y z> <block: Block> <blockStates: block properties> [chainedCommand: executechainedoption_0]

    If/unless block has block states

  14. /execute <subcommand: Option_If_Unless> blocks <begin: x y z> <end: x y z> <destination: x y z> <scan mode: BlocksScanMode> [chainedCommand: executechainedoption_0]

    If unless a set of blocks matches scan criteria

  15. /execute <subcommand: Option_If_Unless> entity <target: target> [chainedCommand: executechainedoption_0]

    If/unless an entity matches

  16. /execute <subcommand: Option_If_Unless> score <target: target> <objective: ScoreboardObjectives> <operation: compareoperator> <source: target> <objective: ScoreboardObjectives> [chainedCommand: executechainedoption_0]

    If/unless score

  17. /execute <subcommand: Option_If_Unless> score <target: target> <objective: ScoreboardObjectives> matches <range: fullintegerrange> [chainedCommand: executechainedoption_0]

    If/unless score in range

  18. /execute run <command: codebuilderargs>

    Run

Arguments

ArgumentTypeWhat it means
anchorActorLocation- `anchored`: ActorLocation
axesstringA string representing the block axes to which the command positions are aligned (floored).
blockBlockThe specific block ID to compare against the block at the given coordinates.
blockStatesblock propertiesThe set of block properties that the tested block must match.
commandcodebuilderargsA string of the final valid command to run once all contexts and conditions are processed.
destination: x y zposition- `dimension`: Dimension
end: x y zposition- `objective`: ScoreboardObjectives
operationcompareoperator- `origin`: target The target of the command to execute. Must be a player name or target selector.
pitchrotationUp-and-down rotation of the command
position: x y zpositionA `vector` of where to run the command from.
rangefullintegerrange- `scan mode`: BlocksScanMode
sourcetarget- `subcommand`: Option_If_Unless
targettarget- `yaw`: rotation Left-to-right rotation context of the command

Examples

Tips

Common mistakes

Bedrock vs Java

Minecraft Java Edition uses the same chained /execute structure with matching subcommands such as align, anchored, as, and at.

See /execute in Java Edition →

FAQ

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

The as clause changes the entity executing the command (who is targeted by @s), while the at clause changes the coordinates, rotation, and dimension to match the selected entity's location.

Why do I get a syntax error using the old execute format?

Minecraft Bedrock Edition updated to the new execute syntax, which replaces the old format with chained subcommands like as, at, if, and run.

Who can use the /execute command?

You must have Game Directors permission level and cheats must be turned on in the world settings to run /execute.

Related commands

/dialogue/function/packstack/reload/reloadpacketlimitconfig/schedule/scoreboard/scriptevent/sendshowstoreoffer/tag/testfor/testforblock/testforblocks/toggledownfall