The /xp Command in Minecraft: Give, Take and Set Experience Levels
/xp gives, takes or sets a player's experience: 30 levels to enchant at the top tier, an event prize or back to zero after a test. It has one trap that catches almost everyone (without the word levels, what you give is points, not levels) and another one with set points. Here's how to write it in chat and in a server's console, how many points each level is worth and what changes if you have EssentialsX.
Who can use it
/xp is the same as /experience (the first is a shortcut for the second) and it's a level 2 command: operators and the console use it. In a singleplayer world you need cheats on; on a server, being op (how to give op). A regular player gets «Unknown or incomplete command».
In chat it goes with a slash; in the server console, without it and always with the player's name, because there's no «you» there: xp add Ana 30 levels.
Rather not set it up yourself? Minecraft servers from €6 a month, no contract and a full refund within 72 hours. Or create a free Minecraft server, no card needed.
Giving levels or points: xp add
The form is /xp add <player> <amount> levels for levels and /xp add <player> <amount> points for points. If you put nothing after the amount, it's points: /xp add @s 30 doesn't give 30 levels, it gives 30 points (a little over three levels if you start from zero). It's the most common mistake.
30 levels for you
/xp add @s 30 levels. With 30 the enchanting table offers the best.To another player
/xp add Ana 10 levels. From the server console, the same but without the slash.To everyone online
/xp add @a 5 levels, the quick prize for an event. The game answers «Gave 5 experience levels to 3 players».A few loose points
/xp add @s 100 points: adds 100 points to the bar, as if you picked up orbs.
Taking experience away
There's no «xp remove»: you take it away with a negative amount. /xp add Ana -5 levels takes five levels from her and /xp add Ana -50 points, 50 points (if the bar doesn't have enough, she drops a level). It never leaves anyone below zero.
To leave someone with nothing, shorter: /xp set Ana 0 levels and then /xp set Ana 0 points, which empties the bar too.
Setting an exact level: xp set
/xp set <player> <amount> levels leaves the level at that number, whatever they had: /xp set @a 0 levels puts everyone at zero before a race or a UHC. Negatives aren't allowed here.
With points it's different, and it's the other trap: /xp set with points doesn't change the total, only how full the bar of your current level is. That's why, if you ask for more points than fit in that level, it fails with «Cannot set experience points above the maximum points for the player's current level». To go up a level, use levels or xp add.
Seeing how much someone has: xp query
/xp query Ana levels tells you her level («Ana has 27 experience levels»). /xp query Ana points tells you the points she has inside the current level, not her lifetime total: with 27 levels and an empty bar, it answers 0.
From a command block or a datapack, the number it returns is useful to check whether someone reaches a minimum (for example, with execute store result score).
How many points each level is worth
Each level costs more than the one before: up to 15, each one takes 2 × level + 7 points; from 16 to 30, 5 × level − 38; from 31 on, 9 × level − 158. That's why going from 30 to 31 costs 112 points and from 0 to 1, only 7. The total points you need from zero:
Level 5
55 points.
Level 10
160 points.
Level 15
315 points.
Level 20
550 points.
Level 30
1395 points: what the best offer on the enchanting table asks for.
Level 40
2920 points. Careful, on the anvil what counts is the cost: a job of 40 levels or more says «Too Expensive!» in survival, however many you have.
Level 50
5345 points.
Level 100
30 970 points.
What happens to experience when you die
When you die you drop 7 points per level in orbs, and 100 at most: someone who dies with 30 levels gets back about 100 points (about 7 levels) and the rest is lost. That's why dying with a lot of experience hurts so much in a survival.
With gamerule keep_inventory true nothing drops: neither items nor experience (that's the rule's name since 1.21.11; before, keepInventory). If you'd rather dying still cost something, look at graves, which keep experience too, and the rest of the rules in the gamerules guide.
If you have EssentialsX: /exp
EssentialsX brings its own /exp and gives it /xp as a shortcut, so with EssentialsX installed /xp add … may not do what you expect. Its form is different: /exp give Ana 30l (the l after the number means levels; without it, points), /exp set Ana 30l, /exp take Ana 5l, /exp show Ana and /exp reset Ana. It works with permissions (essentials.exp, essentials.exp.give…), not op.
The game's one is still there under its full name: /minecraft:xp add Ana 30 levels or /minecraft:experience …. The rest of EssentialsX, in its commands guide.
Ideas for your server
Event prizes: for the winner of a contest or a parkour, xp add Name 30 levels from the console. In a reward crate, the prize can be the same command with the name of whoever opens it (prize crates).
For an enchanted item as a prize, instead of levels, the /enchant command or the /give generator. And for games in rounds (UHC, races), xp set @a 0 levels at the start leaves everyone equal.
Handing out levels in a survival with more people breaks the balance right away: better keep it for events and for fixing what's lost to a server problem, not on request.
On NapNodes
Minecraft servers run on Paper with the latest version, so everything in this guide applies. Commands are typed in the panel's «Console», without the slash and with the player's name; that's also where you make yourself op with op YourName.
If you don't have a server yet, the free one is good for trying these commands with your friends without a card: it switches on when you want to play and you move it to a plan when you decide to stay.
Frequently asked questions
How do I give myself experience levels in Minecraft?
With /xp add @s 30 levels (30 levels). Without the word levels at the end, the amount is points, not levels. You need to be op or have cheats on.
Why does /xp add give me so little experience?
Because without levels at the end the amount is points: 30 points are just over 3 levels. Type /xp add @s 30 levels.
How do you take levels away with /xp?
With a negative amount, /xp add Name -5 levels, or by setting them with /xp set Name 0 levels.
Why does /xp set fail with points?
Because set with points only fills the bar of the level you're on and doesn't let you go past what fits in it. To go up a level, use levels.
How many experience points are 30 levels?
1395 points from zero. Level 15 is 315 and level 50, 5345.
What's the difference between /xp and /experience?
None: /xp is a shortcut for /experience. With EssentialsX, /xp becomes its /exp, and the game's one is written /minecraft:xp.
Shall we set it up for you?
Minecraft servers from €6 a month, never oversold: your RAM is yours alone. And if you'd rather start without paying, there's a free Minecraft server, no card needed.
Your server doesn't show up in the game? Check it in a second with “Is my Minecraft server online?”: players, version and MOTD, free. Need a player's UUID for the whitelist or permissions? Look it up here. Handing out enchanted items? Build the command with the /give generator.
Free tool: /give command generator. Items with enchantments, a coloured name and lore: the /give command written right for your Minecraft version.
Keep reading
- The /effect Command in Minecraft: Give Effects, Make Them Infinite and Clear Them
How to use /effect in Minecraft: infinite night vision, speed or strength at any level, no particles, clearing effects and the list of all 41 effect IDs.
- The /enchant Command in Minecraft: Enchanting With Commands, the Errors and Going Past the Max Level
How to use /enchant in Minecraft, why it fails (level, item, incompatible enchantments) and how to give Sharpness 10 or enchanted books with /give instead.
- Teams in Minecraft with /team: Colours, Friendly Fire and Hidden Names
How to make teams on your Minecraft server without plugins: /team add, join and modify, colours, no friendly fire, hidden name tags and random team picks.