Minecraft wiki entry for Before_14w02a, associated text: Note that when enchanting, the experience levels used will be subtracted from your current level, not your current XP total. This has important implications for leveling above 30—the levels gained will have a high XP cost, but this will not be preserved. For example, if you are enchanting anything at level 30: if you earn enough experience to get to level 31, then enchant, you will be left at level 1. If you had enchanted first, and collected the same amount of experience afterwards, you would have almost reached level 4. Because of this, there is no useful purpose to earning experience past level 39, as this is the maximum level an anvil will require before an item is "too expensive" to enchant or repair.