Sword

"The sword has been a part of Minecraft since January 2010, when it was added alongside diamonds, sticks... oh, and the entire crafting system. Since then, the basic sword concept has pretty much stayed the same but the details have been tweaked repeatedly. Enchantments were added in version 1.0.0, drops from mobs in 1.2.1, and 1.9 – the combat update – changed things up all over again."

- Duncan Geere

Swords are melee weapons that are mainly used to deal damage to mobs and/or players. They also are useful for mining cobwebs.

Mobs
Some monsters can spawn with a sword, and have an 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 and Husk 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. Stone swords dropped by wither skeletons will always be unenchanted.

A vex wields an iron sword which normally has a 0% chance of dropping, because their main hand's  is 0. However, this chance increases by 1 percentage point per level of Looting. It is never damaged and may be enchanted.

Pillagers and vindicators that spawn from raids have a 4.1% chance (5.12% chance on hard) of dropping an iron sword, which will be badly damaged and can be enchanted with a random enchantment.

Trading
Weaponsmith villagers sell enchanted iron swords for 9–10 emeralds as part of their second tier trades, and enchanted diamond swords for 12–15 emeralds as part of their third tier trades.

Apprentice-level weaponsmith villagers sell enchanted iron swords for 2 emeralds, and expert-level weaponsmiths sell enchanted diamond swords for 8 emeralds.

Novice-level weaponsmith villagers have a $2/3$ chance of selling an enchanted iron sword for 7-22 emeralds. Master-level weaponsmiths will sell an enchanted diamond sword for 11-27 emeralds.

The enchantments will be the same as the ones obtained from an enchantment table at levels 5–19.

Natural generation

 * Notes

Attacking
Pressing while holding a sword will increase your damage to both mobs and players. Upon damaging a mob or player, the sword's durability will decrease by 1.

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

Sweep attack
If the attack recharge meter is 84.8% or above, and the player is standing or moving no faster than walking speed, the sword will perform a "sweep" attack which can hit nearby enemies. Enemies near the hit enemy will be knocked back and damaged by from the slashing attack. The Sweeping Edge enchantment will increase the damage dealt by 50% of the normal hit damage for level I, 67% for level II, and 75% for level III. The amount of knockback is 80% that of the knockback due to Knockback I (in other words, 2.8 blocks), and does not benefit from that enchantment. All enemies within 1 block horizontally and 0.25 blocks vertically of any part of the attacked mob and within up to 4 blocks of the player will be knocked back. It is impossible to perform both a sweep attack and critical hit on the same attack.

Java Edition
Swords have an attack speed of 1.6 and take 0.625 seconds to recover.

Bedrock and PS4 editions
$$, swords have no attack cooldown or sweep attack and do the following damage:

The most amount of damage that a diamond sword enchanted with Sharpness V can do is 10 $$, 11 $$ and 13.5 $$ (without critical hits).

Knockback
$$, the knockback inflicted by swords is a bit higher than other melee items, especially while sprinting.

Sword breaking 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.

If a sword is enchanted with Silk Touch, either using Creative or commands, it can collect cobwebs rather than getting the string drop. This is due to the sword being classified as the proper tool for cobwebs.

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.

Swords can be used for instant breaking of bamboo.

Safety around constructions
In Creative mode, swords are unable to break most blocks. However, they can "break" (put out) fire, which are considered blocks. Care must also be taken around minecarts, paintings, item frames and armor stands, which are also not safe with swords in Creative.

Blocking
Anteriorly all types of swords could be used to parry to block some forms of damage. If the player is a sword when attacked, the sword will deflect 50% of the incoming melee, non-magical projectiles like arrows and explosion damage, plus a bit of knockback. The sword is held in front of the player and its durability is not reduced by blocking.

As 1.9 of Java Edition, this functionality was replaced by blocking with [|shields]. The player will also move at a slower rate than sneaking if blocking with a sword, nevertheless, it blocks instantly, unlike the shields which have a 0.25 seconds cooldown period of activation.

Enchantments
Swords can receive the following enchantments:

Fuel
Wooden swords can be used as a fuel in furnaces, smelting 1 item per sword.

Video
''Note: This video is outdated. Since Java Edition 1.9, swords can no longer block attacks. Instead, shields are used.''

Trivia

 * The sword's texture came from Notch's abandoned RPG, Legend of the Chambered. The iron sword's texture was created first, as it was from the game, and the other swords followed.