Durability is a game mechanic where items progressively "wear down" as they are used. The durability of an item is displayed in a bar directly underneath the item's icon within the Inventory or toolbar. The bar starts out GREEN, but as durability decreases, the color gradually turns to RED. When the durability bar is empty, the item is about to break.
Any Tool (Pickaxes, Shovels, Fishing Rods, etc.) will wear down over time as they are used for their intended purpose, eventually reaching a point where it breaks as it's being used. Tools meant for breaking Blocks (such as pickaxes or Axes) will only lose durability when the target block breaks apart. If the tool is meant for another purpose (such as flint and steel or a fishing rod), using it to break blocks will not contribute to durability loss.
Weapons[]
Swords will lose durability if used to attack a Mob. However, they will lose TWICE as much durability if they are used to break blocks (unless the block breaks in one hit).
Axes count as tools, so if they are used to attack a mob, they will lose TWICE as much durability than if they are used to chop wood (unless the block breaks in one hit).
Armor[]
Armor loses durability each time a player is hit by a mob or projectile.
Being near an explosion decreases the durability of armor.
Armor wears down if a player wearing it touches a damaging block such as a Cactus or Lava.
An item that has Unbreaking cast upon it will have a level⁄level+1 chance for the durability to not be reduced when the tool is used (1⁄2 for level I, 2⁄3 for level II, 3⁄4 for level III).
However, if one uses the /give command to obtain a tool with the tag {Unbreakable:1}, that tool has an infinite durability.
Placing a partially-worn item on an Anvil with another item of the same type will consume both, and create a third item of the same type. The new item will have a durability score equal to the remaining durability left on each of the original items (up to the maximum allowable for that type of item/material). The same applies with classic crafting.
The weaker the material, the quicker the item breaks. For example, a stone sword will be more durable than a gold sword, but less durable than an iron sword.
If two partially-worn tools are put side by side in the crafting grid, the tools will merge and combine their durability, and will add 5% durability (e.g., two wooden tools put together will have an additional 3 durability). This is a less expensive way to increase durability than using an Anvil. However, it will remove enchantments that were present on either of the previous items.