/clear Command in Minecraft Java Edition

Remove Items from Player Inventories

Java EditionItems & InventoryPermission: Level 2Bedrock version →

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.

Syntax (Java 26.3, 3 forms)

  1. /clear
  2. /clear <targets>
  3. /clear <targets> <item> [<maxCount>]

The forms you will use most

/clear
Removes every item from the inventory of the player running the command.
/clear <targets>
Removes every item from the inventory of the chosen player or players.
/clear <targets> <item> [<maxCount>]
Removes a specific item or matching group of items from the target players, up to an optional maximum amount.

Arguments

ArgumentTypeWhat 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 testDefines 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.

Examples

Version history

Measured from the game files of every Java release from 1.13 to 26.3.

  1. 1.13 Already in the game in 1.13, the oldest Java version we track.

Tips

Common mistakes

Java vs Bedrock

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].

See /clear in Bedrock Edition →

FAQ

How do I clear only my own inventory?

You can simply type /clear with no extra arguments, or use /clear @s to target yourself.

Can I use /clear to remove items from chests or mobs?

No, the <targets> argument in /clear works on players only, so it cannot target containers or non-player entities.

What happens if I set the maxCount to 0?

Setting <maxCount> to 0 removes zero items, which lets you check if a player has the matching item in their inventory without deleting it.

Related commands

/enchant/give/item/loot/recipe