Creating the Ultimate Sword

Creating the ultimate sword in Minecraft is actually pretty easy, but there's a lot of things you need to keep in mind when doing so. There's a few steps you need to go through in a very specific order to get to your end goal.
When I say ultimate sword, I mean a sword with the maximum amount of possible enchantments, often referred to as a "God Sword". Here's an example of what I mean
The Ultimate Sword
It's often really hard to get to this stage without getting the "Too expensive" error in an anvil. This is because people often make a few mistakes in the process, that I will go over here and give you tricks on how to avoid.

1. Obtaining the proper books

To make the ultimate sword, you need to obtain a very specific set of books.

  1. Sharpness IV
  2. Sharpness IV
  3. Knockback II
  4. Fire Aspect II
  5. Unbreaking III
  6. Looting III
  7. Sweeping Edge III
  8. Mending

Of course, you can swap Sharpness for Bane of Arthropods, or Smite if you really wanted to.
These books need to be what's called "Pure", meaning they need to be only that specific enchantment on the book. This means that you cannot have more than one enchantment on the base-level book. If you do, it could lead to the dreaded "Too Expensive" error on the final product.
Here's an example of what I mean:
Don't do this
Do this
The second image, with a book containing only mending is considered a "Pure" book, and the first image is not.
You will need to ensure this is the case for absolutely all the books that you collect.
Here's some tips for collecting the right books in the shortest amount of time possible:

Do this

1. Enchanting
The best way to collect books for your ultimate sword is to use an enchanting table.
Enchanting
This can take a while, and you will often end up enchanting way too many low-level books, and wasting a lot of Lapis Lazuli while doing so. You might want to set up a grindstone nearby to reclaim the books to re-enchant so that you don't have to go back and kill a lot of cows, set up a large sugar cane farm, or even continue raiding strongholds to get hold of more books. If you're going to enchant things, be sure to go into it with a large supply of Lapis Lazuli already set, about a stack of books, and also be sure to have a good XP farm nearby to quickly get the levels you need. I suggest building an enderman farm, like this one we have on our survival server.
Enderman Farm
These are really simple to build. Here's a tutorial: https://www.youtube.com/watch?v=nh8voJScSbw
2. Villager Trading
The second best way to get the books you need is by trading with villagers. Librarian villagers can trade books for decent prices, especially things like Sharpness IV, and Fire Aspect II which are often difficult to get "pure" from enchanting.
Villager trading
One big benefit to trading with villagers is that you don't have to grind for XP, and you don't have to have a large supply of Lapis Lazuli. You do however need a lot of emeralds, which can be difficult to obtain unless you have a large villager farm already established. If you already have a villager farm that lets you produce a lot of villagers and emeralds very quickly, this may be the best method. In fact, it is for certain the easiest way to get a "pure" mending book, and may be beneficial if you have multiple players looking to get multiple books to make multiple swords.

Avoid

1. Fishing
Yes, you may be able to get lots of books while AFK from fishing, but almost none of them will be "pure". This may be an option if you really don't want to grind, but it will certainly take a lot longer to get the books you need than if you enchant or trade with villagers.
Remember:
Don't do this
Do this
2. Combining low level books
If you know anything about enchanting, you may be tempted to combine a bunch of low-level books to make higher level books, especially with sharpness, but it is absolutely not the best idea to do this at all. This is a really really easy way to make your final product (Or even an intermediate product) "too expensive" and should be avoided at all costs.
Don't combine low-level books
If you have patience, I would really recommend going with enchanting, and then finding a villager with a mending trade to obtain the mending book. It may take a while, and require a lot of resources, but it will be well worth it in the end.

2. Combining the books

Once you have all the books in their "pure" forms, you will need to combine them together before putting the enchantments onto a sword.
Do it like this:

If that's a bit too complicated to understand in words, here's a diagram that shows you the exact right way to combine things to get the final book
How to combine the books

Important!!!!!

You need to combine the books using the minimum amount of XP for each combination. This can be achieved by swapping the orders of each combination to see which one costs the least amount of XP. If you don't do this, you will run into the dreaded "Too expensive" error exceedingly quickly.
Here's what I mean:
Expensive!
This combination of books costs 4 levels. If we swap the two books around...
Less cost!
This combination of the same two books costs only 2 levels. You ALWAYS want to check this with all combinations of books you make and only pick the cheapest one. This is how you can avoid the "Too expensive" error.
Once you have all your books combined, this will be the resulting book:
Final book
There we go, all enchantments on one book!

3. Putting the book on a sword

This part is where you will need to grind up some levels. You can expect the final combination of putting the book on the sword to cost about 35-38 levels. In fact, you should have just enough space left over to name that fancy sword of yours.
Final sword
And that's it! You're all done, and you have the maximum possible enchanted sword in the game! Have fun!
The Ultimate Sword