Minecraft Wiki
Advertisement

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
enchant <targets> <enchantment> [<level>]
  • Bedrock Edition
enchant <player: target> <enchantmentId: int> [level: int]
enchant <player: target> <enchantmentName: Enchant> [level: int]

Arguments[]

JE<targets>: entity
BE: player: target: CommandSelector<Actor>

Specifies the target(s).
Must be a player name, a target selector or a UUID[Java Edition only].

JE: <enchantment>: resource
BE: enchantmentId: int: int or <enchantmentName: Enchant>: enum

Specifies the enchantment to be added to the item held in main hand by the target.
In Java Edition, must be an existing registered resource location in minecraft:enchantment registry. In Bedrock Edition, must be an ID of an enchantment (without namespace)

JE<level>: integer
BE: level: int: int

Specifies the enchantment level. Should be not greater than the maximum level for the specified enchantment[1]. If not specified, defaults to 1.
Must be a 32-bit integer number. In Java Edition, it must be between 0 and 2147483647 (inclusive). In Bedrock Edition, it should be between 1 and 2147483647 (inclusive).

Result[]

CommandTriggerJava EditionBedrock Edition
anythe arguments are not specified correctly Unparseable Unparseable
<targets> or player: target fails to resolve to one or more entities (named player must be online) Failed Failed
level: int is lower than 1 N/A
<level> or level: int is greater than the maximum level for the specified enchantment Failed
all the selected players meet one or more of the following conditions:
  • there's no item in its hand
  • the enchantment is not valid for items in its main hand
  • the enchantment conflicts with current enchantments (for example, "Piercing" cannot be given to a crossbow which already has "Multishot", and "Sharpness III" cannot be given to a sword which already has "Sharpness I")
  • items in its main hand already have this enchantment‌[Java Edition only]
  • items in its main hand already have this enchantment with its maximum level‌[Bedrock Edition only]
OtherwiseSuccessful

Output[]

CommandEditionSituationSuccess Count/execute store success .../execute store result ...
anyJava EditionOn fail000
On success11the number of players whose items are successfully enchanted.
Bedrock EditionOn fail0N/AN/A
On successthe number of players whose items are successfully enchanted.N/AN/A

Examples[]

  • To give the Infinity enchantment to all players holding a bow:
    /enchant @a infinity
  • To enchant the nearest player's held sword with Sharpness 5:
    /enchant @p sharpness 5

History[]

Jigsaw Block (top texture) JE2 BE2
This section needs expansion. 
You can help by expanding it.
Java Edition
1.4.4preAdded /enchant.
1.1317w45aRemoved /enchant.
18w06aRe-added /enchant.
1.19.322w42a<enchantment> now accepts a resource argument, instead of item_enchantment.
Pocket Edition Alpha
v0.16.0build 5Added /enchant.
Bedrock Edition
1.19.20beta 1.19.20.22/enchant command now can be applied on mobs.[2]
1.19.50beta 1.19.50.20Using the /enchant command to apply the same level of enchantment no longer results in a higher level being applied.[3]

References[]

  1. Although /enchant enforces maximum levels and compatibility, other commands (such as /give, /replaceitem, and /data) can bypass these restrictions.
  2. MCPE-113623 — resolved as "Fixed".
  3. MCPE-153204 — resolved as "Fixed".
Advertisement