Commands/enchant

Adds an enchantment to a player's selected item, subject to the same restrictions as an anvil. Also works on any mob or entity holding a weapon/tool/armor in its main hand.

Syntax

 * Java Edition


 * Bedrock Edition

Arguments

 * Specifies the target(s).


 * or
 * Specifies the enchantment to be added to the item held in main hand by the target.
 * Specifies the enchantment to be added to the item held in main hand by the target.


 * Specifies the enchantment level. Should be not greater than the maximum level for the specified enchantment . If not specified, defaults to 1.
 * $$, it should be between 1 and 2147483647 (inclusive).

Examples

 * To give the Infinity enchantment to all players holding a bow:
 * To enchant the nearest player's held sword with Sharpness 5:
 * To enchant the nearest player's held sword with Sharpness 5: