OGTOOLS

Minecraft /clear command

Clears a player's whole inventory or just one specific item.

🎒 Item commands Operator (level 2) Needs cheats enabled Java Edition 26.3

Syntax

/clear
/clear <targets>
/clear <targets> <item> [<maxCount>]

Parts in square brackets are optional, parts in angle brackets are required. You do not type the brackets: Put your own value in their place.

Arguments

ArgumentWhat it does
<item> Only this item is removed. Leave it out and the whole inventory goes.
[<maxCount>] How many to remove. Type 0 and nothing is removed; it only counts.

Examples

/clear

Empties your own inventory completely.

/clear @s dirt

Removes all the dirt you are carrying.

/clear @a rotten_flesh 0

Counts how much rotten flesh everyone has, without removing it.

Good to know

  • Removed items do not drop; they are gone for good.
  • With a count of 0 it only counts: Useful in command block conditions.

How do I run this command?

Press T in game to open chat (or press / directly), type the command and press Enter. While typing, Tab completes the options. This command counts as a cheat: It needs cheats enabled in a singleplayer world, and operator permission on a server (operator (level 2)).

Related commands

🎒 More Item commands

Another tool Minecraft crafting recipes Would rather make the item than give it with a command? See the recipe on the 3x3 grid.

Minecraft is a product of Mojang Studios. This tool is an independent helper made for players and is not affiliated with Mojang or Microsoft.