/tag
Attach invisible labels to entities to target them later.
Overview
What is the /tag command?
The /tag command adds, removes and lists custom string tags on entities. Tags are free-form labels that don't change behaviour by themselves, but they're invaluable for selecting specific entities later with @e[tag=...].
They're the standard way datapacks 'mark' entities — flagging a boss, tracking which mobs have been processed, or grouping spawned entities.
When to use it: Use /tag to label entities with custom markers you can later target precisely with selectors.
At a glance
Syntax
/tag <target> add <name>See it
What it does
Anatomy
Every part, explained
- 1
CommandRequired/tagAdds or removes entity tags.
- 2
TargetRequired<target>Which entity gets the tag.
- 3
ActionRequiredaddUse add, remove, or list.
- 4
Tag nameRequired<name>The custom tag to apply.
Your turn
Try it yourself
Copy & paste
Examples
/tag @s add winnerTag yourself as winner.
/tag @e[type=zombie] add bossTag all zombies as boss.
/tag @s remove winnerRemove the winner tag.
Avoid these
Common mistakes
/tag add winner @s/tag @s add winnerThe target comes before the action.
/tag @s winner/tag @s add winnerYou must say add or remove.
Good to know
Frequently asked questions
- How do you add a tag to an entity?
- Run /tag <target> add <name>, e.g. /tag @e[type=zombie] add boss.
- How do you select entities by tag?
- Use the tag selector argument, e.g. /tp @e[tag=boss] ~ ~ ~ targets only entities with that tag.
- How do you see an entity's tags?
- Run /tag <target> list to print every tag currently on it.
Keep going