All commands
🧠
Advanced

/execute

The Swiss-army command — run other commands as anyone, anywhere, if a condition is met.

Try in Simulator

At a glance

Syntax

Syntax
/execute as <target> at <anchor> run <command>
commandtargetcoordsvaluerequiredoptional

See it

What it does

as @a run jump
One command runs for every target

Anatomy

Every part, explained

  1. 1
    /executeCommandRequired

    Sets up context for another command to run inside.

  2. 2
    as <target>AsOptional

    Whose 'self' (@s) the inner command runs as.

  3. 3
    at <anchor>AtOptional

    Where the inner command runs from.

  4. 4
    run <command>RunRequired

    The actual command to execute. Always comes last.

Your turn

Try it yourself

Playground
10 tokens · press Enter to run

Copy & paste

Examples

/execute as @a at @s run tp ~ ~5 ~

Bounce every player 5 blocks up.

/execute as @e[type=cow] run effect give @s glowing

Make all cows glow.

/execute if entity @e[type=creeper] run say Boom incoming!

Only say it if a creeper exists.

Avoid these

Common mistakes

/execute as @a run @s tp ~ ~5 ~
/execute as @a at @s run tp ~ ~5 ~

After 'run' you write a plain command — no extra target.

/execute run say hi as @a
/execute as @a run say hi

'run' must be last — everything after it is the command.

Keep going

Related commands