Remove Items from Player Inventories
The /clear command removes items from a player's inventory in Minecraft Java Edition. You can use it to empty an entire inventory at once or delete only specific items and quantities.
Players and server admins often use this command when creating custom maps, resetting player gear before a minigame, or cleaning up clutter while building in creative mode.
/clear/clear <targets>/clear <targets> <item> [<maxCount>]/clear/clear <targets>/clear <targets> <item> [<maxCount>]| Argument | Type | What it means |
|---|---|---|
<targets> | target selector players only | Specifies which players to clear using a player name, a UUID, or a target selector that selects players. |
<item> | item test | Defines which item to remove using an item ID, a #tag, or an asterisk (*) to match all items. |
<maxCount> | whole number at least 0 | Sets the maximum number of items to remove as a whole number that is at least 0. |
/clearClears every single item from your own inventory immediately.
/clear @pEmpties the entire inventory of the nearest player.
/clear Steve dirtRemoves all dirt blocks from the player named Steve.
/clear @a diamond_sword 1Takes away at most one diamond sword from every player on the server.
/clear @s #logsRemoves all items that belong to the logs item tag from the player running the command.
/clear @r * 5Removes up to 5 items of any kind from a random player.
/clear Alex emerald 0Tests for how many emeralds Alex has in her inventory without actually removing any of them.
Measured from the game files of every Java release from 1.13 to 26.3.
Bedrock Edition also includes the /clear command, but its syntax adds an integer argument for data values: /clear [player: target] [itemName: Item] [data: int] [maxCount: int].
You can simply type /clear with no extra arguments, or use /clear @s to target yourself.
No, the <targets> argument in /clear works on players only, so it cannot target containers or non-player entities.
Setting <maxCount> to 0 removes zero items, which lets you check if a player has the matching item in their inventory without deleting it.