The sword is a tool used to deal damage at other players and mobs. There are four variants to swords: stone sword, golden sword, diamond sword, and amethyst sword. Swords have a smaller range but deal more damage than spears.
For new players, it is recommend to craft a stone sword to defend themselves and their bases; a stone sword deals enough damage to quickly hunt rabbits and to protect from wolves and spiders. A stone sword can be upgraded to a golden sword, which in turn can be upgraded to a diamond, then amethyst sword. With a diamond or amethyst sword, players can kill other players easily. Some players will see an exposed sword as a challenge or a threat. Be careful when approaching other players to make sure you're not carrying a sword.
For having all the recipes of the swords, please go here.