Updated:
Ready-made commands
| Goal | Java | Bedrock |
|---|---|---|
| Add 30 levels | /xp add @s 30 levels | /xp 30L @s |
| Add 500 points | /xp add @s 500 points | /xp 500 @s |
| Remove 10 levels | /xp add @s -10 levels | /xp -10L @s |
| Reset to level 0 | /xp set @s 0 levels | /xp -10000L @s |
Java writes add, target, amount, unit. Bedrock writes the amount first; an L right after the number means levels, no L means points.
Levels vs points
The green number is your level; the green bar is points. Filling the bar gives a level, and higher levels need more points. On Java, leaving out the unit means points, so /xp add @s 30 adds only 30 points. Add levels to raise levels.
Java commands
| Command | Meaning |
|---|---|
/xp add <target> <amount> levels | Add levels (negative to remove) |
/xp set <target> <amount> levels | Set an exact level |
/xp query <target> levels | Show the current level |
/xp set with points can only fill the current level's bar. To get a level plus a few points, set the level first, then add points. Java 1.12 and earlier used /xp 30L @p, which is why that form fails on current Java.
How many levels you need
| Use | Levels |
|---|---|
| Best enchanting table option | 30 (with 15 bookshelves; costs 3) |
| Anvil repairs and combining | Survival refuses costs of 40 or more ("Too Expensive!") |
Give XP as an item
/give @s minecraft:experience_bottle 64
Bottles o' enchanting drop XP orbs when thrown. As a map reward this feels more natural than /xp, and the orbs also repair Mending gear, which /xp does not. On Bedrock write /give @s experience_bottle 64.
Common problems
- /xp 30L on Java: use
/xp add @s 30 levels. - Forgot levels: the amount was added as points.
- Space before L on Bedrock: write
30Lwith no space. - Losing XP on death: turn on keep inventory, which keeps XP too.
Check your command
The Command Error Doctor checks common syntax mistakes in your browser.