The five enchantments a sword needs
A sword is a damage tool first, so the enchantments worth spending anvil time on are the ones that raise damage, raise drops, or keep the blade alive. Sharpness V adds raw damage to every hit; Looting III increases both the number of drops and the odds of a rare one; Sweeping Edge III (Java Edition only) turns a sweep into real area damage; Unbreaking III multiplies the sword's working life; and Mending repairs the blade out of the experience you are already earning. Knockback is the odd one out — it is common on swords, but on a sword it usually works against you, shoving the mob out of your follow-up swing.
What each one actually adds
None of these numbers depend on your level; they depend on the enchantment's own level, which is why "get it to V" matters more than "have a lot of XP".
| Enchantment | Max | What max level gives you |
|---|---|---|
| Sharpness | V | +3 attack damage in Java (+6 in Bedrock) |
| Looting | III | up to +3 to a mob's drop count, and better odds of a rare drop |
| Sweeping Edge | III | a sweep hits for 75% of the sword's damage (Java only) |
| Unbreaking | III | roughly four times as many hits before the sword breaks |
| Mending | I | repairs 2 durability for every point of XP you collect |
The anvil's 39-level wall
Before any order matters, one rule decides whether a plan is even possible. In Survival and Adventure mode an anvil can only apply an operation worth 39 experience levels or less. Once the cost goes above 39, the anvil refuses the operation with the message "Too Expensive!" — no matter how high your own experience level is. Standing there with 200 levels changes nothing; the wall is a property of the operation, not of you.
That is why a sword can become permanently unworkable even though you have plenty of XP. It is also why the exact wording matters: the limit is on the total cost of that one operation, not on a single ingredient of it. A cheap operation on a heavily-used sword can still be refused, because the prior-work penalty is added to the bill before the anvil checks it against 39.
How the anvil charges you
The cost of an operation is a sum, not a single number. It is the value of the sacrificed item, plus the prior-work penalty of the target, plus the prior-work penalty of the sacrifice — with extra levels added if you rename the item or repair its durability at the same time.
The prior-work penalty is the part that quietly doubles. Every time an item is used in an anvil, it accumulates a penalty that roughly doubles each use: 0, 1, 3, 7, 15, 31… levels, following the formula 2 c − 1 for c uses. Renaming an item does not increase the penalty, which is why the cheapest time to rename a sword is before you enchant it.
| Anvil uses on the item | Prior-work penalty |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 3 |
| 3 | 7 |
| 4 | 15 |
| 5 | 31 |
Read that column backwards and the strategy writes itself: keep the number of anvil uses on the sword as low as you can, and pay the extra levels on the books instead, because a book's penalty only counts while you are merging books.
Three worked examples
Example 1 — five books applied one at a time. Start with a clean diamond sword and apply Sharpness V, Looting III, Sweeping Edge III, Unbreaking III and Mending as five separate operations. The cost of each is its enchantment value plus the penalty already on the sword, so the five operations cost 5, 7, 9, 10, 17 levels — 48 levels in total. Every operation stays under 39, so the plan works, and the order does not change the total. What it does change is the sword itself: after five uses the sword's own penalty is 31.
Example 2 — merge the books first. Now do it the careful way: pair the five books into one, then apply that single book once. Merging costs 25 levels, and the one sword operation costs 29, for 54 levels in total — 6 more than the one-at-a-time route. That difference is invisible on the day and decisive later: the sword has been used once, so its penalty is 1 instead of 31. When you decide you also want Fire Aspect, or you want to rename the blade, you are operating on a cheap sword instead of an expensive one.
Example 3 — the "Too Expensive!" trap. Take the sword from Example 1, with its penalty of 31. Craft one more book carrying Fire Aspect II, Knockback II and Unbreaking III — a value of 9 levels — and try to add it. The operation costs 9 + 31 = 40 levels, which is more than 39, so the anvil refuses it. The same book on a sword whose penalty is still 0 would read 9 + 0 = 9. Nothing about the book changed; only the sword's history did.
Common mistakes that cost levels
- Renaming in the middle. A rename adds a level to the cost and does not add a use, so it is cheapest before you enchant — never between two enchantment operations when the sword is already expensive.
- Repairing on the anvil instead of with Mending. Unit repair is an anvil use, so it raises the sword's penalty. Mending spends experience you were collecting anyway and adds no use at all.
- Merging two finished swords. Combining two enchanted swords is two histories meeting: the result takes the higher use count plus one, and both penalties are charged on the operation.
- Re-applying a lower-level book. On Java Edition the anvil still charges for an enchantment you already have, even when the sacrifice is weaker and the sword's level does not change.
- Ignoring the table. Enchanting at the table is not an anvil use, so a table enchantment you keep adds nothing to the penalty — take the free one first, then spend books on the rest.
Where to get the books
Librarian villagers are the workhorse: break and replace a librarian's lectern until the trade you want appears, then trade, because offers lock in after the first purchase. Fishing, loot chests and the enchanting table fill the gaps. Mending is the rarest of the set and the only one worth hunting specifically, since it is the enchantment that makes the sword effectively immortal — and it is a treasure enchantment, so it never appears as a table result.
Netherite timing
Upgrade the sword to netherite after enchanting. The smithing-table upgrade preserves every enchantment and does not add an anvil use, so the prior-work penalty you worked so hard to keep low is untouched. There is never a reason to re-buy the books you already paid for.
Sources and standards
Where these figures come from
Every rule on this page is taken from the published reference material below rather than from memory. The anvil's 39-level limit, the prior-work penalty formula and the enchantment cost multipliers were checked against the source and re-implemented here so each worked example can be reproduced.
- Minecraft Help Center — official Mojang/Microsoft support documentation for game mechanics.
- Minecraft (official site) — the game of record for mechanics, versions and release notes.
Figures, formulas and reference tables last verified: 1 October 2026.