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. Caving and fishing for long periods of time can bring you a slow but steady supply of Name Tags. As of the 1.8 snapshots, the trading revamp makes 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", or "jeb_".

Trivia

 * 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.
 * As of 1.7.4, 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.
 * 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.
 * Named villagers lose their name when they are turned into zombies by other zombies. The same counts for turning Zombie Villagers into normal villagers. This is because the mob isn't actually changing, but rather a new mob (of the opposite type) is spawned in its place.
 * Named Mooshrooms lose their names when sheared for the same reason.
 * It is possible to name hostile mobs and store them permanently. This allows large "armies" to be built up.
 * Adult Villagers cannot be renamed because right-clicking opens their trading GUI.
 * If in multiplayer and one player interacts with the Villager, another can rename it.
 * You can name villager children.
 * Pigs with saddles can be named but right-clicking will cause the player to mount the pig at the same time.
 * You can name mobs that you interact with, (e.g. pigs with saddles, villagers, horses, etc.) by clicking and holding. You will still interact with them, but when you dismount or close the window, their name will be changed.
 * If you name a silverfish, it will lose its name if it goes into a nearby cobblestone, stone bricks, or smooth stone block.