ECEnchantCalcCalculator

Minecraft Anvil Mechanics Explained

The anvil looks simple - put two things in, pay some levels - but underneath it runs a precise cost model. Understanding three concepts (enchantment cost, prior work penalty, and the 39-level cap) explains why the same enchantments can cost 15 levels in one order and 'Too Expensive' in another.

The three rules of anvil cost

  • Every enchantment has a rarity weight (common = 1, rare = 4). Applying it costs levels based on its level and weight.
  • Every time an item or book is used on an anvil, its prior work penalty (PWP) increases - and the next anvil use adds 2^PWP - 1 levels from that item's side.
  • If a single merge would cost more than 39 levels, the anvil refuses: 'Too Expensive!'. This cap counts everything: enchantment costs plus both prior work penalties.

Why combining order matters

The prior work penalty grows exponentially. A freshly enchanted book has zero prior work, so merging two books costs almost nothing extra. But if you apply books to your sword one by one, the sword's penalty doubles with every step - by the sixth book you are paying dozens of extra levels, or hitting the cap. The fix: merge books with each other first (cheap merges build a single super-book), then apply once to the gear.

Combining books first is almost always cheaper

Two Sharpness I books merge into Sharpness II for a tiny cost. Stack that logic: build up your biggest enchantments into one combined book, merge in the cheap enchantments along the way, and apply the final book to the item in a single anvil use. The calculator automates exactly this: it tries every merge tree and returns the cheapest one.

Naming and other costs

Renaming an item on the anvil adds a small extra cost. Repairing by consuming materials (e.g. iron ingots) also counts as anvil work and increases the penalty. For god gear, do all enchanting first and never use the anvil for repairs - that is what Mending is for.

FAQ

What is the prior work penalty in Minecraft?
It is a counter that increases by 1 every time an item is worked on an anvil. Each anvil use costs extra levels equal to 2^penalty - 1 from that item's side, which is why repeated anvil work gets expensive fast.
What is the maximum anvil cost?
39 levels. Any single anvil operation that would cost more than 39 levels is blocked with 'Too Expensive!'. Prior work penalties are the usual cause.
Does renaming an item increase the cost?
Renaming adds a small level cost and - importantly - counts as anvil work if the item is also being enchanted or repaired, adding to its prior work penalty.
How do I reset the prior work penalty?
You cannot reset it on the same item. The only fix is planning: combine books with each other before touching the item, so the item itself is worked only once or twice.