Minecraft XP Commands — Give, Set, and Check Experience
On Java Edition, use /experience add @p <amount> points to add raw XP points, or /experience add @p <amount> levels to add full levels. To set an exact level, use /experience set @p <level> levels. On Bedrock Edition, the command is /xp — use /xp <amount> @p for points or /xp <amount>L @p for levels. Both editions let you check experience with /experience query on Java; Bedrock has no query subcommand.
Java Edition: give XP points and levels
Java Edition uses /experience (alias /xp) for all experience operations.
Give XP points: /experience add @p 100 points
Give XP levels: /experience add @p 5 levels
To set to exactly level 30 (enough to enchant at max):
/experience set @p 30 levels
Use set for a precise target; use add to reward a relative amount.
Java Edition: remove XP
Remove experience with a negative amount:
/experience add @p -10 levels
You cannot go below level 0. To remove all experience:
/experience set @p 0 levels /experience set @p 0 points
Java Edition: query a player's experience
Read a player's current experience in chat:
/experience query @p levels /experience query @p points
The levels query returns the current level number. The points query returns how many points into the current level the player is.
Bedrock Edition: give XP
Bedrock Edition uses /xp with different syntax from Java.
Give XP points: /xp 100 @p
Give XP levels (note the L suffix, no space): /xp 5L @p
There is no set or query subcommand on Bedrock. To set an exact level:
/xp -1000000L @p /xp 30L @p
Give XP to all players
Both editions let you target all players with @a:
Java: /experience add @a 5 levels Bedrock: /xp 5L @a
To target players within a radius:
Java: /experience add @a[distance=..20] 5 levels Bedrock: /xp 5L @a[r=20]
Frequently asked questions
What is the difference between XP points and XP levels?
Levels are the number shown on your XP bar (e.g. level 30). Points are the smaller units that fill a level. The number of points per level increases as you level up.
Can I use /xp on Java Edition?
Yes — /xp is a shortcut alias for /experience on Java Edition. Both work identically.
Why can't I remove XP below zero?
/experience add with a negative value is clamped at 0. Use /experience set @p 0 levels and /experience set @p 0 points to fully clear experience.
Is there a way to query XP on Bedrock Edition?
Not directly via command. Bedrock does not have an /xp query subcommand. A scoreboard with a dummy objective can approximate level tracking.
How much XP is needed to reach level 30?
On Java Edition, it takes 1,395 total XP points from level 0 to reach level 30. The /experience set command handles the math — just target the level directly.