Updated:

Java 1.21.5 and later

/give @p minecraft:netherite_sword[enchantments={sharpness:255,looting:10,fire_aspect:2,sweeping_edge:3,mending:1,unbreaking:3},unbreakable={},custom_name="God Sword"] 1

Java 1.20.5 – 1.21.4

/give @p minecraft:netherite_sword[enchantments={levels:{sharpness:255,looting:10}},unbreakable={}] 1

These versions need the extra levels:{…} wrapper. The custom name was written as a JSON string, so the Give generator is the easiest way to get it right for your version.

Java 1.20.4 and earlier

/give @p minecraft:netherite_sword{Enchantments:[{id:"minecraft:sharpness",lvl:255s}],Unbreakable:1b} 1

This NBT form is why commands from old videos turn red on current versions.

Sword enchantments

EnchantmentIDNormal max
SharpnesssharpnessV
LootinglootingIII
Fire Aspectfire_aspectII
KnockbackknockbackII
Sweeping Edge (Java)sweeping_edgeIII
UnbreakingunbreakingIII
MendingmendingI

Sharpness, Smite and Bane of Arthropods normally cannot be combined, but /give ignores that rule.

Raise the damage itself (Java 1.21.5+)

Instead of enchantments, you can set the sword's attack damage and speed directly.

/give @p minecraft:diamond_sword[attribute_modifiers=[{type:"attack_damage",amount:19,operation:"add_value",id:"mypack:damage",slot:"mainhand"},{type:"attack_speed",amount:-2.4,operation:"add_value",id:"mypack:speed",slot:"mainhand"}]] 1

Bedrock Edition

/give @p netherite_sword
/enchant @p sharpness 5
/enchant @p looting 3
/enchant @p unbreaking 3

Hold the sword while running /enchant. Bedrock commands cannot go above the normal maximum level.

Common problems

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.