Java 26.2
Experience Command
Experience
@p
/experience add @p 5 levels
XP and levels
The /experience command splits along two axes people mix up: add versus set, and points versus levels. Adding 30 levels is not the same as adding 30 points, and set overwrites instead of granting. Pick the action, the unit and the target here and copy the exact form.
Adding 30 points fills part of the current level; adding 30 levels grants thirty whole levels. They are very different amounts, and mixing them up is the usual /experience mistake. Choose the unit explicitly.
/experience set <target> <n> levels overwrites their level to n, unlike add which increases it. Use set to force a known level, add to grant a reward.
/xp is the short alias for /experience; both accept the same add, set and query forms in points or levels.
Java 26.2
@p
/experience add @p 5 levels