
Command
/experience
Adds, sets or shows the experience points or levels of players. /xp is a second name for the same command.
| /experience add <target> <amount> [(levels|points)] |
| /experience query <target> (levels|points) |
| /experience set <target> <amount> [(levels|points)] |
| /xp ... (the same as /experience) |
| Argument | Kind of value | What to type |
|---|---|---|
| <target> | Target selector | The players to change. add and set accept several players; query accepts exactly one. One or more players. |
| <amount> | Whole number | A whole number. For add it can be negative. For set it must be 0 or higher. |
| Permission level | 2: operators, worlds with cheats on, command blocks and functions |
| Works in | Operators on multiplayer servers, singleplayer worlds with cheats enabled, and command blocks and functions. |
| Short forms | /xp |
| Result | add 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. |
| add | Gives experience to the players. The amount may be negative to take experience away. |
| set | Sets the levels, or the points inside the current level, to an exact number. The amount cannot be negative. |
| query | Shows 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 levels | If neither points nor levels is written after the amount, add and set use points. |
| Limit for set points | set 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". |
/experience add @s 100Gives you 100 experience points.
/experience add @s 5 levelsGives you 5 experience levels.
/xp add @p -3 levelsTakes 3 experience levels from the nearest player.
/experience set @s 30 levelsSets your experience level to 30.
/experience set @a 0 pointsClears the progress of every player toward the next level.
/experience query @s levelsShows your experience level.
/xp query @s pointsShows how many points you have collected in your current level.

