Name Tag

A name tag is an item used to name existing mobs. It is used by naming the name tag using an anvil, and then right clicking any mob that you want to name, holding the name tag in your hand. Name tags with exactly the same name will stack (as will unnamed tags), while name tags with different names will not. Name tags have no crafting recipe; aside from creative mode, they can be found in naturally generated chests (such as in dungeons). They can also be obtained by fishing.

Obtaining
There is no crafting recipe. Name tags are only found in the chests of dungeons, and as a rare catch through fishing. Spelunking and fishing for long periods of time can bring you a slow but steady supply of Name Tags. Librarian villagers trade Name Tags for 20-22 Emeralds apiece.

Usage and behavior
To use a name tag it must first be renamed with an anvil. The player can then right-click mobs to give them the name given to the name tag with the anvil. In survival, the name tag is consumed during the process. In creative, the name tag will not be consumed. The name tag will not be dropped by a renamed mob. To rename a mob, just use another name tag on that mob. The new name will replace the old name.

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 7 or fewer blocks away. Mobs that are named using the name tag will also not despawn in the world, similar to tamed mobs. Players can therefore use name tags, not only to name mobs, but also to retain them if players travel far distances.

Any mob can be named, excluding the Ender Dragon. Even hostile mobs like the Wither or Ghast can be named. Endermen can be named, as well, but tend to teleport away. Naming mobs has no effect on their behavior, though they may change appearance if you name them "Dinnerbone", "Grumm", Toast or "jeb_".

Trivia

 * Named mobs can lose their name for one of a handful of reasons:
 * Named silverfish that go into blocks
 * Named villagers getting turned into zombies (and vice versa)
 * Shearing named mooshrooms
 * Currently, they are exclusive to the PC version
 * Name tags were added at the request of Paul Soares Jr.
 * As part of an easter egg, renaming a mob to "Dinnerbone" or "Grumm" causes the mob to flip upside down.
 * If you do this to a horse or pig and ride it you don't flip over, You see its legs moving as you ride.
 * Renaming a sheep to "jeb_" will cause it to cycle through all possible sheep colors in a fading rainbow effect. When sheared, the wool of the sheep will remain whatever color the sheep was before being named. When its wool grows back it will retain the rainbow effect.
 * Named hostile mobs still despawn if you switch the difficulty to Peaceful (and do not reappear if you switch back to Easy, Normal or Hard). It is therefore advised not to use name tags on hostile mobs, or to take great caution, as nametags are rather rare.
 * It is possible to name hostile mobs and store them permanently. This allows large "armies" to be built up. However if keeping these in survival mode, you'll have a somewhat hard time controlling them
 * Adult Villagers can't be renamed in singleplayer, even if you shift right-click.
 * If in multiplayer and one player interacts with the Villager, another can rename it.
 * You can name villager children.
 * A villager that is already an adult can be named by changing it's Age value to a negative value that gives enough time to apply the Name Tag before it grows up by using the /entitydata command. (The value of -100 should suffice in this case.)
 * Pigs with saddles can be named but right-clicking will cause the player to mount the pig at the same time.
 * Hostile mobs spawned from a renamed spawn egg will still despawn, unlike mobs named with a name tag.
 * Renaming a rabbit "Toast" will cause it to have a special skin.