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 you want to name with the renamed name tag in your hand. Name tags have no crafting recipe and are only found in dungeons and in Creative mode. Name tags with the exact same name will stack, while name tags with different names will not.

Usage and behavior
To use a name tag, it must first be renamed to the desired name with an anvil. This will cost little experience points for a short name and quite a lot for a long name. If you're on creative, it won't cost anything. The player can then right-click mobs to give the mob 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 the 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 to not only name mobs, but to retain them if players travel far distances.

Any mob can be named excluding adult Villagers (the children can be named as they do not offer trades to the player, and will retain their name through adulthood) and the Ender Dragon. Even hostile mobs like the Wither or Ghast can be named. However, if it is desired to keep a named Zombie or Skeleton, it must be in a shaded area so it does not burn up in the sun. Endermen can be named as well, but they are not really worth the effort because they tend to just teleport away. Keep in mind that hostile mobs will still attack players in survival, even if you named them. There is no crafting recipe. Name tags are only found in dungeons and nether fortresses for now.

Trivia

 * Name tags were added at the request of Paul Soares Jr.
 * It appears the code handling naming villagers is buggy: child villagers can always be named, and occasionally adult villagers can be named too. It is not apparent if this is intentional.
 * In 1.6, as part of an easter egg, renaming a mob to "Dinnerbone" or "Grumm" would cause the mob flip upside down.
 * If you do the Grumm or Dinnerbone easter egg to a horse and ride it you don't flip over, You see it's legs moving as you ride.
 * Named hostile Mobs still despawn if you switch the difficulty to Peaceful.
 * It is possible to name villagers by double clicking on them (clicking one them once more when the trade menus opens)