/clear Command Generator
BetaPick who, which item and how many, and watch the matching stacks disappear from an inventory. Set the count to 0 to count items without removing any.
Describe it — AI writes the command
Type what you want in plain words. The AI fills the form below, so you can see it and change anything. It follows the edition and version you picked.
Checking the AI…
Paste a command— edit it here or move it to another version
Empty = the player running the command.
An item ID, an item tag like #wool, or * for any item.
Inventory
Your command · Java 26.3
27 characters/clear @a minecraft:dirt 32
Raw editor
How it works
Without an item, /clear empties the whole inventory, armour and off-hand included. With an item it only removes that item, and with a count it stops after that many. A count of 0 removes nothing and just reports how many there are, which is how map makers check if a player has something.
Java 1.20.5 and later
Items can be tested on their components, and * matches any item:
clear @a minecraft:dirt 32
clear @p minecraft:diamond_sword[damage=0]
clear @s *[enchantments~[{enchantments:"minecraft:sharpness"}]]
clear @a #minecraft:woolJava 1.13 to 1.20.4
clear @p minecraft:diamond_sword{Damage:0} 1Java 1.8 to 1.12
Arguments are in a fixed order, so a count needs a data value before it (-1 means any):
clear @p minecraft:wool 14 5
clear @p minecraft:diamond_sword -1 -1 {display:{Name:"Blade"}}Bedrock
Bedrock has no NBT, components or tags, but still takes a data value before the count:
clear @a dirt -1 32 clear @p red_wool
FAQ
How do I clear only one item type?
Add the item: /clear @p minecraft:dirt removes all dirt and nothing else. Add a number after it to remove only that many.
How do I check if a player has an item without taking it?
Use a count of 0: /clear @p minecraft:diamond 0. Nothing is removed, and the command succeeds only if the player has a diamond (handy in command blocks).
Does /clear remove armour?
Yes. With no item it clears the whole inventory including armour slots and the off-hand. Give an item to keep the rest.
How do I clear all wool colours at once?
On Java 1.13+ use the tag: /clear @a #minecraft:wool. On Java 1.12 and older, wool with data -1 matches every colour. Current Bedrock has a separate ID per colour (red_wool…), so clear them one by one.
Why does my /clear with NBT not work anymore?
Java 1.20.5 replaced item NBT with components. {Damage:0} became [damage=0]. The generator tells you when your test is in the wrong form for the version.