Anvil mechanics — the exact formula
Every anvil operation's price is the sum of three things. Learn them once and the calculator's output stops looking like magic.
The formula
Per operation (Java Edition, per the Minecraft Wiki):
| Component | What it is |
|---|---|
| Enchantment value | For each enchantment coming from the sacrifice: cost multiplier × resulting level. Enchantments that don't apply to the target are ignored. |
| Prior work penalties | Both items' penalties are charged: 2ⁿ − 1 for n prior anvil uses. |
| Incompatibilities | +1 per enchantment on the target that conflicts with one on the sacrifice. The conflicting enchantment does not transfer. |
| Extras (not in our tool) | +1 for renaming, +2 for repairing a damaged item. |
So cost = Σ(multiplier × result level) + pen(left) + pen(right) + conflicts.
The rule that makes order matter
The result's penalty is max(left, right) + 1 — not the sum. Two items that have each been through two anvils (penalty 3) combine into an item with penalty 7 (three uses), not penalty 15. Sequence your merges badly and you pay 31 and 63 where a balanced tree pays 3 and 7 for the same work.
That single asymmetry is the entire reason an "optimal order calculator" exists — see prior work penalty for the table and the trap.
Which side is which
The left slot is the target, the right slot is the sacrifice. Only the sacrifice's enchantments are priced — which means the expensive enchantment should sit on the right as few times as possible. The Wiki's classic demonstration: Soul Speed III on the left with Mending on the right costs 2 levels; reversed, 12. Same two books, six times the price.
Our calculator tries both orientations at every step, so you don't have to think about it.
Multipliers in one line
Sharpness, Efficiency, Protection, Power, Unbreaking and friends are 1× (books: 1). Fire Aspect, Looting, Fortune, Mending and most utility enchants are 4× as items but 2× as books. The heaviest — Thorns, Silk Touch, Infinity, Channeling, Soul Speed, curse-book tier — are 8× as items, 4× as books. The full table is on the XP cost table.
Why books are the standard route
Because the book multiplier is roughly half the item multiplier, and because books can be traded for cheaply. The downside is a longer combine tree — more operations, more penalties — which is precisely the trade-off the calculator resolves for you. More on books vs items.