News
Game
Guides
Downloads
Versions
/clear
COMMANDS ITEMS & INVENTORY CHEATS · LEVEL 2 Added in 1.14 or earlier

/clear command in Minecraft

/clear deletes items from one or more players' inventories: everything, one type of item, or a set number. With a maximum of 0 it removes nothing and only counts the matching items, which is handy for maps, shops and command block systems.

Syntax

/clear [<targets> [<item> [<maxCount>]]]
ArgumentExpectsWhat it does
targetsoptionalPlayer selectorone or severalPlayers whose inventory is cleared: a name, @s for yourself, @p for the nearest or @a for everyone. Defaults to you.
itemoptionalItem testItem to remove: an ID like minecraft:dirt, a tag like #minecraft:logs, or * for any item.
maxCountoptionalWhole numberat least 0Maximum number of items to remove. Without it, all matching items go; 0 only counts them.
All 4 forms
  • /clear
  • /clear <targets>
  • /clear <targets> <item>
  • /clear <targets> <item> <maxCount>

Examples

Empty your own inventory

/clear

Removes every item you carry, armor and off hand included.

Java 26.3

Remove dirt from every player

/clear @a minecraft:dirt

Deletes all Dirt from the inventories of all online players.

Java 26.3

Take five diamonds

/clear @p minecraft:diamond 5

Removes up to five diamonds from the nearest player, fewer if he carries less.

Java 26.3

Remove every kind of log

/clear @s #minecraft:logs

The logs tag matches all wood logs, so one command clears them all.

Java 26.3

Count emeralds without removing

/clear @s minecraft:emerald 0

Removes nothing and reports how many Emerald items you carry.

Java 26.3
Build your command

Fill in the fields, then copy the command.

Command generator

IDs for /clear

Diamond Sworddiamond_swordNetherite Swordnetherite_swordNetherite Pickaxenetherite_pickaxeElytraelytraTotem of Undyingtotem_of_undyingEnchanted Golden Appleenchanted_golden_appleGolden Applegolden_appleEnder Pearlender_pearlFirework Rocketfirework_rocketTridenttridentMacemaceCommand Blockcommand_blockBarrierbarrierDebug Stickdebug_stickLightlightStructure Blockstructure_blockMonster SpawnerspawnerKnowledge Bookknowledge_book

Items →

What /clear removes

Without arguments, /clear empties your whole inventory, armor and off hand included. The items are deleted, not dropped. The Ender Chest is a separate storage and stays untouched. The item argument is an item predicate: a plain ID, a tag such as #minecraft:logs, or * for any item.

Counting items with maxCount 0

With 0 as maxCount, nothing is removed and the game only reports a count, for example "Found 12 matching item(s) on player Steve". With /execute and store result, you can copy that number into a /scoreboard objective and check whether a player carries enough Emerald items before you take them as a price.

Common errors

  • No items were found on player Steve: the player has none of the requested item.
  • No player was found: the name or selector matches nobody online.

Containers such as chests are not affected: for those, use /item. To hand items back, use /give.

✓ Checked in Java Edition 26.3 · updated 2 November 2026

/clear: FAQ

Does /clear delete the items or drop them?

It deletes them. Nothing appears on the ground and the items cannot be recovered.

Can /clear empty a chest?

No, it only works on player inventories. To empty a container slot, use /item replace with minecraft:air.

How do I use /clear?

Type it in the chat with cheats on: /clear [<targets> [<item> [<maxCount>]]].

Who can use /clear?

Cheats on, or operator level 2.

Related commands