Skip to content
WikilyWIKILY
All games23 Wikis · pick your game
Commands and cheatsAll commands

Switch game

23 Wikis · pick your game
/experience

Command

/experience

Adds, sets or shows the experience points or levels of players. /xp is a second name for the same command.

Syntax

/experience add <target> <amount> [(levels|points)]
/experience query <target> (levels|points)
/experience set <target> <amount> [(levels|points)]
/xp ... (the same as /experience)

Arguments

ArgumentKind of valueWhat to type
<target>Target selectorThe players to change. add and set accept several players; query accepts exactly one. One or more players.
<amount>Whole numberA whole number. For add it can be negative. For set it must be 0 or higher.

Details

Permission level2: operators, worlds with cheats on, command blocks and functions
Works inOperators on multiplayer servers, singleplayer worlds with cheats enabled, and command blocks and functions.
Short forms/xp
Resultadd and set report the amount and the player or number of players, and return the number of players changed. query reports the value and returns it.
addGives experience to the players. The amount may be negative to take experience away.
setSets the levels, or the points inside the current level, to an exact number. The amount cannot be negative.
queryShows the levels of one player, or the points that player has collected inside the current level. It works on a single player only, and levels or points must be written.
Points or levelsIf neither points nor levels is written after the amount, add and set use points.
Limit for set pointsset with points fails if the amount is as large as or larger than the points needed to reach the player's next level: "Cannot set experience points above the maximum points for the player's current level".

Examples

/experience add @s 100

Gives you 100 experience points.

/experience add @s 5 levels

Gives you 5 experience levels.

/xp add @p -3 levels

Takes 3 experience levels from the nearest player.

/experience set @s 30 levels

Sets your experience level to 30.

/experience set @a 0 points

Clears the progress of every player toward the next level.

/experience query @s levels

Shows your experience level.

/xp query @s points

Shows how many points you have collected in your current level.

Join the creator communityThe people who build the Minecraft Java Edition wiki are on our Discord. Ask questions or suggest pages.Join Discord (opens Discord in a new tab)