Sword

A sword is a melee weapon, that is mainly used to deal damage to mobs and/or players. Swords are also useful for mining cobwebs and bamboo.

Unit repair
A sword can be repaired in an anvil by adding units of the tiers' repair material, with each repair material restoring 25% the sword's maximum durability, rounded down.

Mobs
Some mobs can spawn with a sword and have an 8.5% chance of dropping them upon death by player. This chance is increased by 1% per level of Looting, up to a maximum of 11.5% with Looting III. Zombies and husks can drop iron swords, zombified piglins and piglins can drop golden swords, and wither skeletons can drop stone swords. The dropped sword is usually badly damaged and may be enchanted. Stone swords dropped by wither skeletons are never enchanted.

A vex wields an iron sword that 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 a damaged iron sword. This sword has a 50% chance be enchanted.

Trading


$$, apprentice-level weaponsmith villagers sell enchanted iron swords for 7-21 emeralds, and master-level weaponsmiths sell enchanted diamond swords for 13-27 emeralds.

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

The enchantments of the swords offered by villagers are the same as the ones obtained from an enchantment table at levels 5–19.

Attacking
Pressing while holding a sword inflicts damage on both mobs and other players. 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 sweeping 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 a sweep attack at the same time as a critical hit or sprint-knockback 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, stronger damage:

The most amount of damage that a sword enchanted with Sharpness V can do is 11 $$ and 15.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 blocks. Care must be taken around minecarts, paintings, item frames and armor stands, which can be broken 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.

ID




History
Previously, since the Adventure Update, all types of swords could be used to parry to block some forms of damage. If the player is blocking with a sword when attacked, the sword deflects 50% of incoming damage from melee, non-magical projectiles like arrows, and explosions, along with minimizing knockback. The sword is held in front of the player and its durability is not reduced by blocking. The player moves at a slower rate than sneaking if blocking with a sword. Sword blocks could be engaged and disengaged instantly, with no delay between the input and damage mitigation nor cooldown between lowering a block and raising a new one. After the Combat Update, this functionality was replaced by blocking with shields and to accommodate the dual wield system. Shields, unlike sword blocks, will fully negate damage from blockable attacks, but they have a 0.25 second startup period before damage can be mitigated and can be temporarily disabled by attacks with an axe.
 * Blocking

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.