Most of these need operator permission — run them from an op's chat, a command block, or the server console.

How to Use the XP Command Generator

  1. Pick a mode: Add to give experience on top of what a player already has, Set to force an exact total, or Query to read back a player’s current experience.
  2. Enter the Target player or selector – the default @s targets the command’s executor.
  3. For Add/Set, enter an Amount and choose the Unitpoints (raw experience points) or levels (whole experience levels).
  4. Copy the generated /xp command into a command block, the console, or an operator’s chat.

Command Syntax Reference

/xp add <target> <amount> [points|levels]
/xp set <target> <amount> [points|levels]
/xp query <target> <points|levels>

/xp is the classic short form; the modern Java command tree also accepts the longer /experience alias with identical arguments. points refers to raw experience points (the small orbs), while levels refers to whole experience levels shown above the XP bar – each level costs progressively more points to fill, so adding “5 levels” is not the same fixed point cost every time. /xp set ... levels jumps a player straight to the start of that level with an empty bar; /xp add ... levels instead fills the current bar toward the next level(s). query always requires a unit and returns the value in chat/output rather than changing anything.

Frequently Asked Questions

What’s the difference between XP points and XP levels?

Points are the raw experience units picked up from orbs; levels are the whole numbers shown next to the green XP bar. The point cost to fill one level increases as a player levels up (it’s cheap at low levels, then grows), so /xp add @s 1 levels can consume very different point amounts depending on the player’s current level.

Does /xp set overwrite existing experience or add to it?

It overwrites – /xp set forces the target’s experience to exactly the given amount, discarding whatever they had before. Use /xp add instead if you want to top up on top of existing experience.

Can I use /xp to remove experience from a player?

Yes, indirectly – /xp add <target> -<amount> points (a negative amount) reduces experience, and /xp set can be used to set a lower exact total. There’s no dedicated “subtract” mode; negative numbers with add do the job.

Why did /xp query return a different number than I expected?

Querying in points mode returns total accumulated experience points across the player’s whole level history (a large cumulative number), while levels mode returns just the current level number shown on screen – they’re deliberately different scales, not a bug.

Related Tools