Minecraft Wiki

The Minecraft Wiki is no longer considered as official by Microsoft and therefore several changes are required to be made, including to the wiki's logo. Please read this announcement for more information.

READ MORE

Minecraft Wiki
Advertisement
xp
Aliases
  • /experience[JE only]
Permission level
required

2‌[JE only]
1‌[BE only]

Restrictions

Cheat only‌[BE only]

Adds or removes player experience.

Syntax[]

  • 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]

Arguments[]

JE: <amount>: integer (in add mode)

Specifies the amount of experience points or levels to give to the player. Negative values remove experience instead of adding them.
Must be a 32-bit integer number.

JE: <amount>: integer (in set mode)

Specifies the amount of experience points or levels to be set to the player.
Must be a 32-bit integer number. And it must be between 0 and 2147483647 (inclusive).

BE: amount: int: int

Specifies the amount of experience points or levels to be added to the player. Negative values remove experience instead of adding them.
Must be a 32-bit integer number.
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).

JE: <targets>: entity (in add and set mode)
BE: player: target: CommandSelector<Player>

Specifies the target of the command. In Bedrock Edition, if not specified, defaults to the command's executor.
Must be a player name, a target selector or a UUID[Java Edition only]. And the target selector must be of player type.

JE: <targets>: entity (in query mode)

Specifies the target of the command.
Must be a player name, a target selector or a UUID. And the target selector must be of single-player type.

Result[]

CommandTriggerJava EditionBedrock Edition
anythe arguments are not specified correctly Unparseable Failed
/... add ...
/... set ...
<targets> fails to resolve to one or more online players Failed N/A
/... query ...<targets> fails to resolve to one or more online players
/... set ...<amount> is greater than the current capacity of xp bar for any player
anyplayer: target fails to resolve to one or more online players N/A Failed
player: target is not specified when the command's executor is not a player
anyOn successAdds/removes/queries experience.

Output[]

CommandEditionSituationSuccess Count/execute store success .../execute store result ...
anyJava EditionOn fail000
/... query ...On success11the number of experience points or levels the player have
/... add ...
/... set ...
On success11the number of targeted players
anyBedrock EditionOn fail0N/AN/A
On successthe number of players who are given or taken experience.N/AN/A

Examples[]

History[]

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 <targets>, /experience set <targets>, and /experience query <targets>.
Negative points are now supported.
Pocket Edition Alpha
v0.16.0build 1Added /xp.
Advertisement