News
Game
Guides
Downloads
Versions
/experience
COMMANDS PLAYERS & MOVEMENT CHEATS · LEVEL 2 3 SUBCOMMANDS Added in 1.14 or earlier

/experience command in Minecraft

/experience, also available as /xp, adds, removes, sets or reads a player's experience, counted in levels or in points. Use it to prepare enchanting tests, refund players on a server or read levels inside a command system.

Syntax

/experience add <target> <amount> [levels|points]
/experience query <target> (levels|points)
/experience set <target> <amount> [levels|points]
All 8 forms
  • /experience add <target> <amount>
  • /experience add <target> <amount> levels
  • /experience add <target> <amount> points
  • /experience query <target> levels
  • /experience query <target> points
  • /experience set <target> <amount>
  • /experience set <target> <amount> levels
  • /experience set <target> <amount> points
/experience add
/experience add <target> <amount> [levels|points]
ArgumentExpectsWhat it does
targetPlayer selectorone or severalPlayers whose experience changes: @s, @p, @a or a name. query accepts only one player.
amountWhole numberNumber of levels or points. With add it can be negative to remove experience.
All 3 forms
  • /experience add <target> <amount>
  • /experience add <target> <amount> levels
  • /experience add <target> <amount> points
/experience query
/experience query <target> (levels|points)
ArgumentExpectsWhat it does
targetPlayer selectoronePlayers whose experience changes: @s, @p, @a or a name. query accepts only one player.
All 2 forms
  • /experience query <target> levels
  • /experience query <target> points
/experience set
/experience set <target> <amount> [levels|points]
ArgumentExpectsWhat it does
targetPlayer selectorone or severalPlayers whose experience changes: @s, @p, @a or a name. query accepts only one player.
amountWhole numberat least 0New value, 0 or more. In points, it cannot go past the bar of the current level.
All 3 forms
  • /experience set <target> <amount>
  • /experience set <target> <amount> levels
  • /experience set <target> <amount> points

Examples

Thirty levels for enchanting

/xp add @s 30 levels

Gives you 30 levels, enough for the best enchanting table offers.

Java 26.3

Experience points for everyone

/experience add @a 100

Without a unit, every player receives 100 experience points.

Java 26.3

Take five levels away

/xp add @p -5 levels

A negative amount removes five levels from the nearest player.

Java 26.3

Reset your level to zero

/experience set @s 0 levels

Sets your level to 0 without touching the progress inside the bar.

Java 26.3

Check your current level

/experience query @s levels

Prints your current level in the chat.

Java 26.3

Copy the level into a score

/execute store result score @s levels run xp query @s levels

Stores your level in the levels objective, which must already exist.

Java 26.3
Interactive tool

Command generator

Fill in the fields, copy the command, paste it in the chat. Syntax checked against Java Edition 26.3.

Turn on JavaScript to use the interactive version.

/experience add @p 30 levels

Calculated from the Java Edition 26.3 game files

Levels or points

Points fill the green bar, levels are the number above it. Without a unit, the command uses points. Adding enough points raises the level, and a negative amount with add takes experience away. set only accepts 0 or more, and setting points above the current bar fails with "Cannot set experience points above the maximum points for the player's current level".

Practical uses

The best offers of the Enchanting Table need level 30, and repairs on an Anvil also cost levels, so /xp add @s 30 levels is the quickest setup for a test. Mending and the Bottle o' Enchanting work with points instead.

Reading the value

query returns the level or the points of one player. With /execute and store result score, the value goes into a /scoreboard objective that you can test or display. For a simple reward, /give can also hand out Bottles o' Enchanting.

✓ Checked in Java Edition 26.3 · updated 2 November 2026

/experience: FAQ

Is /xp the same command as /experience?

Yes. /xp is an alias and takes exactly the same sub-commands and arguments.

How do I remove levels from a player?

Use add with a negative amount, for example /xp add @p -5 levels, or set the exact value with /xp set @p 0 levels.

How do I use /experience?

Type it in the chat with cheats on: /experience add <target> <amount> [levels|points].

Who can use /experience?

Cheats on, or operator level 2.

Copy & paste lists with /experience

Related commands