EntitiesJavaBedrock

/tag

Manages arbitrary string tags attached to entities. Tags are invisible labels you can filter on with the tag= selector argument, making them the standard way to track state across command blocks and datapack functions without scoreboards.

Syntax

Parameters

targets
entity selector
Entities to tag.
action
literal
add / remove / list.
nameoptional
string
Tag name (required for add/remove).

Examples

  • Give yourself the tag 'chosen'.

  • Tag every zombie as a raid mob.

  • Use the tag in a selector to remove them later.

Common questions

How do I select entities by tag?

Use the tag= selector argument: @e[tag=chosen] matches entities with the tag, and @e[tag=!chosen] matches those without it.

Permission level

/tag requires Cheats (op level 2). In single-player you need the world's "Allow Cheats" toggle on. On a multiplayer server you need to be opped — see /op.