Sword

A s. Upon damaging a mob or player, the sword's durability decreases by 1.

Attacking a boat or a minecart with a sword instantly destroys it, without decreasing 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 performs a "sweep" attack that can hit nearby enemies. Enemies near the hit enemy are knocked back and damaged by from the slashing attack. The Sweeping Edge enchantment increases 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 are knocked back. It is impossible to perform both a sweep attack and critical hit on the same attack. A sweep attack is performed only when the player swings downward; hitting an entity above the player's head does not perform a sweep attack.

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

Bedrock Edition
$$, 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 $$ and 14.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 gets dropped:
 * White: an original block.
 * Blue: block's normal drop (e.g. seeds, sapling, apple).
 * Red: nothing.

Swords can also 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.

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.''

History
"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

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.
 * With the introduction of netherite swords, it is possible to one-hit kill all undead mobs in the game (except withers and zombies/skeletons with random armor) using a sword with the Smite V enchantment, without the need to perform a critical hit (this was previously only possible with a Smite V stone, iron, or diamond axe). This may make the Smite enchantment more desirable.