MineToolsminetools.cn · Minecraft Java Tools

Clear Items Command /clear

Generate Minecraft /clear commands to empty an inventory or clear specific items by item, tag, name, enchantment, or custom data. You can also count items and store the result in a scoreboard. Includes a command to clear dropped items.

Loading game data…

Clear items:/clear @s empties your inventory,/clear @s diamond 10 clears only 10 diamonds,/clear @a empties every player’s inventory. To clear item drops on the ground, use /kill @e[type=item]。

Frequently Asked Questions

How do I count items without clearing them?

Set the count to 0:/clear @s diamond 0 returns the number of diamonds without clearing them. Use `execute store` to save the result to a scoreboard.

How do I clear items with a specific name?

Starting in 1.21.5, use /clear @a *[custom_name="金币"]; for 1.20.5–1.21.4, the name must be written as a JSON string *[custom_name='"金币"']; earlier versions use NBT matching. The generator formats it for the selected version.