Updated:

Weapon IDs

WeaponID
Swordnetherite_sword, diamond_sword, …
Axenetherite_axe, …
Bowbow
Crossbowcrossbow
Tridenttrident
Macemace (1.21+)

Enchantments for each weapon

WeaponEnchantments
Swordsharpness, looting, fire_aspect, sweeping_edge, mending, unbreaking
Axesharpness, efficiency, unbreaking, mending
Bowpower, punch, flame, infinity, unbreaking
Crossbowquick_charge, multishot or piercing, unbreaking
Tridentloyalty or riptide, impaling, channeling
Macedensity or breach, wind_burst, unbreaking

"Or" marks pairs that normally cannot go on the same item. Java /give can force them together, but some then cancel out; a trident with Riptide will not return with Loyalty.

Commands (Java 1.21.5+)

# Bow
/give @p bow[enchantments={power:5,punch:2,flame:1,infinity:1,unbreaking:3}] 1
# Crossbow
/give @p crossbow[enchantments={quick_charge:3,multishot:1,unbreaking:3}] 1
# Trident
/give @p trident[enchantments={loyalty:3,impaling:5,channeling:1}] 1
# Mace
/give @p mace[enchantments={density:5,wind_burst:3,unbreaking:3}] 1

Older versions use a different format. Choose your version in the give command generator.

Give arrows as well

/give @p arrow 64

An Infinity bow still needs one arrow in the inventory. Infinity has no effect on crossbows, so give a full stack. Tipped arrows can be made with the potion generator.

Bedrock Edition

/give @p bow
/enchant @p power 5
/enchant @p infinity 1

Give the weapon first, hold it, then run /enchant once per enchantment. Bedrock only allows the normal maximum levels.

For more power, see the strongest sword and strongest bow guides.

Common questions

Check your command

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