Sword

The Sword is a melee weapon.

Mobs
Some monsters can spawn with a sword, and have a 8.5% (9.5% with Looting I, 10.5% with Looting II and 11.5% with Looting III) chance of dropping them upon death by player: Zombies can drop iron swords, Zombie Pigmen can drop golden swords, and Wither Skeletons can drop stone swords. It will usually be badly damaged, and may be enchanted.

Trading
Iron and diamond swords can be bought from Weapon Smith villagers for emeralds, as a second tier and third tier trade respectively. They are enchanted with a level 5-19 enchantment.

Natural generation
Stronghold slab altars and village blacksmith chests may contain iron swords in stacks of 1.

Attacking
Swords are used to damage both mobs and players. Upon damaging a mob or player, the sword's durability will decrease.

Attacking a boat or a minecart with a sword will destroy it faster and will not decrease the sword's durability.

Blocking


Swords are able to block attacks by holding. This will reduce most damage by 50% and will reduce the player to a speed slower than sneaking.

Damage
The following table summarizes the damage that swords of different materials inflict. Enchantments can change these statistics.

Critical hits add a damage bonus of up to 50% (rounded down), plus one heart.

The formula to find the minimum of the total lifetime damage is Durability × Damage per hit = Lifetime damage minimum. The formula to find the maximum is Durability × Critical Hits = Lifetime damage maximum.

Sword digging times
A sword can also be used to destroy certain blocks more quickly than with fists. Using a sword to destroy any block that doesn't break instantly decreases its durability by 2.

The following table shows the time it takes to break blocks on which swords have any effect. Colors indicate what will be dropped:
 * White: an original block.
 * Blue: block's normal drop (e.g. seeds, sapling, apple).
 * Red: nothing.

Trivia

 * The sword's texture came from Notch's abandoned RPG, Legends of the Chambered. The iron sword's texture was created first, as it was from the game, and the other swords followed.
 * When blocking, the player's vertical movement speed does not decrease. This applies to flying, falling, swimming up or sinking, and climbing ladders.
 * A foam Iron Sword can be purchased on the merchandise page of minecraft.net.