Skip to content
WikilyWIKILY
All games23 Wikis · pick your game
Commands and cheatsAll commands

Switch game

23 Wikis · pick your game
/tag

Command

/tag

Adds, removes or lists the custom tags stored on entities, which selectors can then match with tag=.

Syntax

/tag <targets> (add <name>|remove <name>)
/tag <targets> list

Arguments

ArgumentKind of valueWhat to type
<targets>Target selectorThe entities to change or inspect. Any number of entities, given as a selector, a player name or a UUID. One or more entities.
<name>TextThe 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.

Details

Permission level2: operators, worlds with cheats on, command blocks and functions
Works inServer operators, players in a singleplayer or LAN world with cheats enabled, the server console, command blocks and functions.
ResultAdd 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 limitAn entity can hold at most 1024 tags. Adding a tag to an entity that already has 1024 does nothing.
Add failsIf no target gained the tag, the command fails with "Target either already has the tag or has too many tags".
Remove failsIf no target had the tag, the command fails with "Target does not have this tag".
Listing several entitiesWith more than one target, list shows the combined set of tags of all targets, not a list per entity.
Tag namesA tag name is a single word without spaces.

Examples

/tag @s add builder

Adds the tag builder to you.

/tag @e[type=minecraft:zombie,distance=..10] add marked

Adds the tag marked to every Zombie within 10 blocks.

/tag @a remove builder

Removes the tag builder from every player who has it.

/tag @s list

Lists all of your tags.

/tag @e[tag=marked] remove marked

Removes the tag marked from every entity that carries it.

/tag @p add in_game

Adds the tag in_game to the nearest player.

Join the creator communityThe people who build the Minecraft Java Edition wiki are on our Discord. Ask questions or suggest pages.Join Discord (opens Discord in a new tab)