/xp Command
Adds, sets, or queries player experience points or levels. /xp is an alias for /experience. Negative amounts in 'add' mode remove experience. 'query' returns the current level or raw point total.
Syntax
experience add <targets> <amount> [levels|points] | experience set <targets> <amount> [levels|points] | experience query <targets> (levels|points)Permission: OP level 2Edition: Java
Examples
/xp add @p 10 levels/xp add @s 500 points/xp set @p 30 levels/xp query @s levelsNotes
Java Edition only — Bedrock uses '/xp <amount>L [player]' syntax instead. Amount accepts 32-bit integers; negative values subtract experience. 'set' fails if the specified point amount exceeds what the current level bar can hold. When adjusting levels, existing point progress within the current level is scaled proportionally.