From Minecraft Wiki
< Commands(Redirected from Commands/xp)
Jump to: navigation, search


First introduced

Beta 1.9 (5)
PE Alpha 0.16.0 (PE Alpha 0.16.0 build 1)

Adds or removes player experience.


  • Java Edition
experience add <targets> <amount> [levels|points]
experience set <targets> <amount> [levels|points]
experience query <targets> (levels|points)
xp add <targets> <amount> [levels|points]
xp set <targets> <amount> [levels|points]
xp query <targets> (levels|points)
  • Bedrock Edition
xp <amount: int> [player: target]
xp <amount: int>L [player: target]


<amount> (BE: amount: int)

Specifies the amount of experience to give to the player. This amount may represent either an amount of points or an amount of levels.
If an L is added to the end, adds levels instead‌[Bedrock Edition only].
In Bedrock Edition:
If the amount is expressed in points, it must be between 0 and 2,147,483,647 (inclusive, without the commas).
If the amount is expressed in levels, it must be between -2,147,483,648 and 2,147,483,647 (inclusive, without the commas).
In Java Edition:
For experience add and xp add, it must be between -2,147,483,648 and 2,147,483,647 (inclusive, without the commas).
For experience set and xp set, it must be between 0 and 2,147,483,647 (inclusive, without the commas).
Negative values remove experience instead of adding them.

<targets> (BE: player: target)

Specifies the target of the command. If not specified, defaults to the command's executor. Not optional in command blocks.
Entities other than players are not allowed.


Fails if arguments are not specified correctly, or if <targets> fails to resolve to one or more online players.

On success, adds/removes experience or adds/removes levels. Total experience and levels are not reduced below 0.



Java Edition
1.0.0Beta 1.9 Prerelease 5Added /xp. The command took a player name and then a number of xp orbs to award.
1.3.112w16a/xp is now usable in singleplayer.
Syntax changed to have the number of orbs first, and then the player, and the player is now optional.
1.4.212w39aAdded L notation for levels. Levels can be subtracted, but points cannot, failing with the message "Cannot give player negative experience points".
The limit for /xp is now 2,147,483,647 (231−1) instead of 5,000.
1.1317w45aAdded /experience and made /xp alias it.
Restructured syntax into /experience add, /experience set, and /experience query.
Negative points are now supported.
Pocket Edition Alpha
0.16.0build 1Added /xp.