/clear
Remove items from a player's inventory.
What is /clear used for?
What /clear is for
Removes items from a player's inventory — all of them, or just a specific item, optionally up to a maximum count.
When to use /clear
Reset inventories at the start of a minigame, confiscate a banned item, or take payment in a datapack shop by clearing a set number of an item.
Tips for /clear
Run /clear with no item to empty everything. Use a count of 0 to count matching items without removing them — useful as a condition in /execute.
Syntax
Parameters
- targetsoptional
- entity selector
- Players to clear from. Defaults to executor.
- itemoptional
- item ID
- Specific item to remove. Omit to clear everything.
- countoptional
- integer
- Max count to remove. Default removes all matches.
Command builder
Configure the options below to generate a ready-to-paste /clear command.
Examples
Empty the nearest player's inventory.
Remove all dirt from every player.
Take exactly one diamond from the nearest player.
Common questions
How do I clear a player's whole inventory?
Run /clear <player> with no item — e.g. /clear @a empties everyone's inventory.
How do I remove just one item type?
Name the item: /clear @s minecraft:dirt, optionally with a max count, e.g. /clear @s minecraft:dirt 16.
Permission level
/clear requires Cheats (op level 2). In single-player you need the world's "Allow Cheats" toggle on. On a multiplayer server you need to be opped — see /op.