Commands
How to Give XP With Commands in Minecraft
The /xp command adds experience to any player instantly. Pick levels to bump the number above the hotbar, or points to fill the bar by a precise amount. Below is the full syntax with selectors, removal, and querying.
The full /xp syntax
The command is /xp add|set|query <target> <amount> [levels|points]. add changes the amount relative to what a player already hasset overwrites it, and query reads it back.
<target> accepts a player name or a selector: @p nearest player@s yourself@a all players@r a random player. Negative amounts with add subtract, e.g. /xp add @p -3 levels.
Leaving off the last word defaults to points on legacy versions, so always state levels or points to avoid surprises. The whole command also works under its long name /experience.
Quick answers
+What is the command to give XP in Minecraft?
Use /xp add <target> <amount> levels for levels, or /xp add <target> <amount> points for raw experience. Example: /xp add @p 30 levels.
+What is the difference between levels and points?
levels gives whole experience levels (the number above the hotbar). points gives raw XP that fills the bar partway. 30 levels is far more XP than 30 points.
+How do I give XP to all players?
Use the @a selector: /xp add @a 50 levels gives every online player 50 levels at once.
+How do I remove or reset a player's XP?
Subtract with a negative amount like /xp add @p -10 levels, or wipe completely with /xp set @p 0 levels and /xp set @p 0 points.
+Is /experience the same as /xp?
Yes. /experience is the full command and /xp is its built-in shorthand alias. Both accept the same add, set, and query arguments.
+Why does the /xp command not work?
Cheats must be enabled, or you must be opped. On a server run /op YourName from the console first; in single-player open the world to LAN with cheats allowed.
Database →
Command Reference
Syntax, arguments and examples for every command.
Hosting →
Managed Hosting
Skip the setup: a managed server online in minutes.
Database →
Item Database
Every item with its stats, IDs, recipes and uses.
Guides →
More Server & Admin guides
Run a server: setup, hosting, permissions, worlds and crossplay.