Torch & Anvil

Anvil Mechanics: Why Order Is Half the Cost

Verified: Java 26.3 / Bedrock 26.50 · 2026-09-16 · Java rules; Bedrock difference noted below · Updated 2026-09-16

Combine the same five books onto the same sword in two different orders and one player pays 46 levels while the other pays 31. Nothing about the result differs. That gap — a third of the bill — is pure sequencing, and it is why the enchantment optimizer searches every combine tree instead of applying a rule of thumb. This guide walks the machinery the search runs on.

The penalty that doubles

Every object remembers how many times it has been through an anvil, and its prior work penalty is 2 to that count, minus one: 0, 1, 3, 7, 15, 31, 63. Both sides of a combine pay their penalty into the step's cost, and the result's count becomes the larger of the two plus one. The doubling is the whole strategy problem in one line. An item that eats six operations one at a time accumulates 0 + 1 + 3 + 7 + 15 + 31 in penalties alone — 57 levels before a single enchantment is priced — while a balanced tree of the same six operations tops out around 3 and 7. Past six anvil uses the penalty alone is 63 — over the survival cap before any enchantment is priced, which is why heavily reworked gear eventually refuses everything.

What a transfer actually charges

The other half of the bill is the enchantment cost: for each enchantment on the sacrifice, the final level it reaches on the result, times that enchantment's multiplier. Multipliers are per-enchantment and come in pairs — one for sacrificing an item, a cheaper one for sacrificing a book, roughly half. Sharpness is 1 either way; Looting is 4 from an item, 2 from a book; Soul Speed is 8 and 4 — and the wiki's own worked figure, Soul Speed III by book at 3 × 4 = 12 levels, is an anchor in our test suite. Equal levels below the enchantment's max merge upward one level; unequal levels keep the higher; and in Java the transfer is charged even when the level does not improve.

The strategic consequence: enchantments riding the target side of a combine are never re-charged, while everything on the sacrifice side is. Expensive enchantments want to reach the item early and then stay put; cheap ones can afford to ride merged books.

The worked plan: 46 versus 31

Take a fresh sword and five books — Sharpness V, Looting III, Unbreaking III, Mending, Fire Aspect II. One book at a time, in that order, the steps cost 5, 7, 6, 9, 19: a 46-level total whose last step nearly triples on penalties alone. The optimal plan the search finds costs 31 with no step above 10:

StepCombineLevels
1Looting III book onto the sword6
2Unbreaking III book onto the Sharpness V book3
3Mending book onto the Fire Aspect II book2
4Sharpness + Unbreaking book onto the sword10
5Fire Aspect + Mending book onto the sword10

Notice what the optimum did. It refused to let the sword's use count climb early for anything expensive, it merged books so each transfer re-charges only cheap riders, and it kept every step small enough that penalties never compound. Pairing evenly is not itself the error. Six of the fifteen ways to pair these five books into two pairs and a single reach 31 at their best ordering; the pairing walked above — Sharpness with Looting, Unbreaking with Mending, Fire Aspect alone — lands at 34 as walked and 33 at its own best, because it re-transfers the wrong riders. Every one of those totals is brute-forced in the tests. All three totals, and the step-by-step 6, 3, 2, 10, 10, are asserted in our tests, with the optimum double-checked by a second, independent brute-force implementation.

Too Expensive, and the cap as a design constraint

Survival anvils refuse any single operation of 40 or more levels — 39 is the last workable price. The cap binds per step, not per plan, so a good order is not just cheaper in total: it is sometimes the difference between a build being possible and the anvil showing red. The optimizer prefers survival-legal plans outright and only falls back to an over-cap plan, clearly marked, when no legal order exists at all.

Scope, and the Bedrock difference

This tool prices combining; it leaves out repair costs and the flat one-level rename. Incompatible enchantments — Sharpness with Smite, Silk Touch with Fortune, the four Protections with each other — cannot coexist, so the optimizer validates your book list up front and refuses conflicted sets instead of pricing an impossible item. And Bedrock players should not use these numbers at all: Bedrock charges the difference between final and initial level rather than the final level, so its optimal orders genuinely differ. Modeling one edition honestly beats averaging two.

Sources

The penalty law, the cost formula, the per-enchantment multiplier table, the merge rules, and the 39-level cap were verified 2026-09-01 against the Minecraft Wiki's anvil mechanics documentation (minecraft.wiki/w/Anvil_mechanics), including the halved book multipliers. That page is the only source claimed here, and it supplies its own check: the Soul Speed III figure of 12 levels is the wiki's worked example, and this site's implementation reproduces it exactly.