Name Tag

A name tag is an item used to name mobs in the world.

Fishing
Name tags can be caught from fishing as part of the treasure category.

Trading
Librarian villagers trade name tags for 20–22 emeralds a piece as part of their tier 6 trades.

Usage
To use a name tag it must first be renamed with an anvil, which will cost 1 experience level. If it is not renamed, it will have no effect when used on a mob. After the name tag is renamed, the player can it on a mob to give it the name given to the name tag from the anvil. Mobs and name tags can be renamed any number of times.

Once a mob is named, it will keep its name and use up the name tag.
 * However, a named silverfish that goes into a block will not be named when the block is broken, since it will actually be another, newly-generated silverfish.

Baby animals and villagers will keep their name when they become adults. Named villagers will keep their name if they become zombie villagers, and named zombie villagers will keep their name when cured.
 * When a passive mob is named, it will not count towards the passive mob cap.

Limitations
Any mob can be named, except the ender dragon, and players.

A name tag can rename an armor stand, though it will not show the nameplate above its head until  is set as an extra step.

Most mobs that can be interacted with by pressing will perform the  action instead of being named. A villager will be renamed instead of opening the trading interface. A saddled pig will be renamed instead of being ridden. Any other mob that can be interacted with can be renamed if the player uses the name tag while in a nether portal, as the nether portal suppresses the action.

To get a Name Tag with the name "Name Tag", the player must either go through a two-step process of naming the tag something that isn't "Name Tag" and then renaming it to "Name Tag", or switch the game's language settings to another language so that it can be done on the first try.

Behavior
Renamed mobs will have their name displayed over their head in the fashion as a mob named through a renamed spawn egg. Their names can only be seen if they are aimed at from four or fewer blocks away.

Mobs that are named using the name tag will also not despawn in the world, similar to tamed mobs. The only exception is if the mob is hostile and the difficulty is switched to "Peaceful".

If a renamed mob kills a player, the custom name will be used in the death message in place of the mob type name.

Easter eggs
Any mob that receives the name "Dinnerbone" or "Grumm" will be rendered upside down.

Naming a sheep "jeb_" will cause its wool to fade between the dye colors, producing a rainbow effect. This won't affect the wool it drops when sheared or killed.

Naming a rabbit "Toast" will cause it to have a special memorial skin.

Naming a vindicator "Johnny" will cause it to be aggressive with all mobs (excluding evokers and other vindicators).

Trivia

 * Name tags were added at the request of Paul Soares Jr.
 * A stack of up to 64 name tags can be renamed at once. The cost is 1 experience level per stack, regardless of how many name tags were stacked.