Clear command generator

Clear items from a player's inventory — all of them, or only a specific item

How to use the Clear command generator

  1. Choose the edition and version that match your game
  2. Specify a target, or leave it blank to clear your own inventory
  3. Specify an item and max count, or leave blank to clear everything
  4. Copy the command and run it in Minecraft

Worked examples

The examples below come out of the same generator as the form above, so the commands and explanations always match what the tool produces. Copy one and adjust it from there

1. Empty the whole inventory

Naming no item clears everything — the usual way to reset players before a new round

/clear @a

What it does Will clear all items from the inventory of all players.

2. Remove just one kind of item

Name an item to leave everything else alone — for confiscating one specific thing

/clear @p minecraft:diamond

What it does Will clear "Diamond" from the inventory of the nearest player.

3. Remove a set number of an item

A max count subtracts only part of the stack — the basis of an item-based shop

/clear @s minecraft:emerald 5

What it does Will clear "Emerald" from the inventory of themselves (whoever runs the command), up to 5 item(s).

How this command differs by edition and version

This is the first example above, run through every edition and version this tool supports. Versions that produce the same result share a row

Every version this tool supports produces the same result, so a command you copy works without version-specific edits

Java Edition 1.21.5 and up Java Edition 1.20.5 - 1.21.4 Java Edition 1.13 - 1.20.4 (legacy NBT) Bedrock Edition (stable)
/clear @a

Before you use these