Enchanting is an in-game mechanic that allows you to give special abilities to tools and armor. You will need an enchanting table in survival mode, but you can use the ‘/enchant’ command if you are in creative mode with cheats enabled.
Enchanting through the enchantment table requires player experience or levels and Lapis Lazuli. Once you place the tool/armor/book, you can select from three choices of enchantments, each requiring different amounts of experience and Lapis Lazuli. Once you select one the item will be enchanted. Surrounding your enchanting table with bookshelves will increase the levels and tier of enchantments available.
If you choose to use the command, you will need to use it like so:
/enchant [Player name] [name of enchantment], [level of enchantment]
Here are some crafting recipes to help you out!
Enchanting Table: 1 Book, 2 Diamonds, 4 Obsidian
This is the starting point for enchanting. Once you have an enchanting table placed down you will be able to access the lower tier enchantments. Placing bookshelves around the crafting table will give you access to the higher tier enchantments.
Book: 3 Paper 1 Leather
If you would like to make enchanted books you can find them or craft them. You can enchant them with one book and three Lapis Lazuli in an enchanting table. You can also obtain them randomly from fishing as well.
Bookshelves: 6 Planks and 3 Books
Placing this around an enchanting table will allow you to get higher tier enchantments. 15 bookshelves will max out your enchanting table. The ideal position of the bookshelves is a square of 15 placed in a 5x5-block outline, with the enchantment table in the middle.
Anvil: 3 Iron Blocks and 4 Iron Ingots
Anvils will let you repair enchanted tools and combine two tools/items of the same kind together, giving you one tool with all the previous enchantments (unless two enchantments conflict with each other). Additionally, you can combine enchanted books with a tool/item to add the enchantment.