
Command
/tag
Adds, removes or lists the custom tags stored on entities, which selectors can then match with tag=.
| /tag <targets> (add <name>|remove <name>) |
| /tag <targets> list |
| Argument | Kind of value | What to type |
|---|---|---|
| <targets> | Target selector | The entities to change or inspect. Any number of entities, given as a selector, a player name or a UUID. One or more entities. |
| <name> | Text | The tag to add or remove. A single word without spaces. When removing, the game suggests the tags the targets currently have. One word without spaces. |
| Permission level | 2: operators, worlds with cheats on, command blocks and functions |
| Works in | Server operators, players in a singleplayer or LAN world with cheats enabled, the server console, command blocks and functions. |
| Result | Add and remove report the tag and the entity (or the number of entities) that changed, and return the number of entities that changed. List reports the tags and returns how many different tags were found across the targets. |
| Tag limit | An entity can hold at most 1024 tags. Adding a tag to an entity that already has 1024 does nothing. |
| Add fails | If no target gained the tag, the command fails with "Target either already has the tag or has too many tags". |
| Remove fails | If no target had the tag, the command fails with "Target does not have this tag". |
| Listing several entities | With more than one target, list shows the combined set of tags of all targets, not a list per entity. |
| Tag names | A tag name is a single word without spaces. |
/tag @s add builderAdds the tag builder to you.
/tag @e[type=minecraft:zombie,distance=..10] add markedAdds the tag marked to every Zombie within 10 blocks.
/tag @a remove builderRemoves the tag builder from every player who has it.
/tag @s listLists all of your tags.
/tag @e[tag=marked] remove markedRemoves the tag marked from every entity that carries it.
/tag @p add in_gameAdds the tag in_game to the nearest player.

