The cheapest order to enchant
The order you combine enchantments in changes what they cost. Get it wrong and you can pay double, or hit the anvil's limit and be unable to finish the item at all. Pick your gear below and this works out the cheapest sequence.
Enchantments to apply
Pick the enchantments you want and this works out the cheapest order to combine them.
Why the order changes the price
Two separate rules decide what an anvil charges, and they pull in opposite directions. Understanding both is the whole trick.
The prior work penalty
Every time an item goes through an anvil it remembers, and the next use costs more. The penalty doubles and adds one each time, so a single item runs 0, 1, 3, 7, 15, 31 levels of pure tax before you have paid for a single enchantment. By the sixth visit that tax alone has eaten most of your budget. This is why touching your good gear as few times as possible matters more than which enchantments you are adding.
Everything gets re-priced
The part most guides skip. When you combine two books, the anvil charges the full price of every enchantment on the sacrificed book, not just the new one. It keeps no memory of what you already paid. So every extra hop a book takes charges you again for everything it is carrying.
The popular advice is often wrong
You will read everywhere that you should always pair your books up into a balanced tree before touching the tool. For a lot of real cases that is more expensive, not less, because of the re-pricing rule above. Here is a Diamond Pickaxe taking Efficiency V, Unbreaking III, Fortune III and Mending:
| Approach | Total levels | Verdict |
|---|---|---|
| One book at a time onto the pickaxe | 27 | Fine, and simple |
| Pair the books into a balanced tree | 34 | Worse than doing nothing clever |
| Bundle the two cheapest, apply that last | 23 | Cheapest |
The balanced tree costs seven levels more than simply applying each book in turn. Pre-combining only helps when the books you bundle are cheap ones, or when a single step would otherwise break the anvil limit.
The 40 level wall
In survival an anvil refuses any single operation costing 40 levels or more, and shows "Too Expensive". Note that this applies per step, not to the total. A plan costing 60 levels across five steps is perfectly legal. One step costing 41 is not, and no amount of extra levels will let you complete it. The calculator flags any step that crosses the line.
Levels are not XP
The anvil charges levels, but levels get more expensive the higher you climb. Going from level 0 to 30 takes 1,395 experience points, while the next 10 levels alone cost more than the first 20 did. That is why a plan that looks only slightly cheaper in levels can save a great deal of actual grinding.
How this is worked out
The cost of each enchantment comes from the game's own files for Java Edition 1.21, not from a table we typed out, so it stays right. Books are charged at half the rate an item is, and Java charges for the final level of an enchantment rather than the difference, which is why numbers from Bedrock guides disagree.
Rather than guessing with a rule of thumb, the calculator searches the possible orders and keeps the cheapest. It has to: the prior work penalty combines by taking the larger of the two items rather than adding them, so a step that looks cheap now can force an expensive one later. A simple greedy rule gets that wrong.