How the anvil counts
When a book sits in the right slot of the anvil, you pay for every enchantment on it: its level times a fixed factor. On top comes the prior work penalty of both parts: every item and every book remembers how often it has been on the anvil. The penalty grows from 0 to 1, 3, 7, 15 and 31 levels – it nearly doubles every time.
Why the order matters
If you put all books onto the same sword one after another, its penalty grows with every step. If you first merge books in pairs and only put them onto the item at the end, the penalty stays small. The calculator tries every possible order and picks the cheapest.
Avoiding “Too Expensive!”
In survival the anvil refuses any step that would cost 40 levels or more and shows “Too Expensive!”. The calculator plans so that no step goes above 39 levels. If that is impossible with your selection, it tells you.
Fewest levels or least experience?
“Fewest levels” looks for the smallest sum of all steps. “Least experience” counts the experience points you have to collect for each step: one step for 30 levels costs far more points than two steps for 15 levels each. Pick it when you are low on experience.