How to Use the Clear Command in Minecraft
This Minecraft tutorial explains how to use a game command to clear your inventory with screenshots and step-by-step instructions.
You can clear items from a player's inventory using the /clear command in Minecraft. Let's explore how to use this cheat (game command).
Supported Platforms
The /clear command is available in the following versions of Minecraft:
Platform | Supported (Version*) |
---|---|
Java Edition (PC/Mac) | Yes (1.4.2) |
Pocket Edition (PE) | Yes (1.0.5) |
Xbox 360 | No |
Xbox One | Yes (1.2) |
PS3 | No |
PS4 | Yes (1.14.0) |
Wii U | No |
Nintendo Switch | Yes (1.5.0) |
Windows 10 Edition | Yes (1.0.5) |
Education Edition | Yes (1.0.18) |
* The version that it was added or removed, if applicable.
NOTE: Pocket Edition (PE), Xbox One, PS4, Nintendo Switch, and Windows 10 Edition are now called Bedrock Edition. We will continue to show them individually for version history.
Requirements
To run game commands in Minecraft, you have to turn cheats on in your world.
Clear Command
- Java
- PE
- Xbox
- PS
- Nintendo
- Win10
- Edu
Clear Command in Minecraft Java Edition (PC/Mac)
In Minecraft Java Edition (PC/Mac) 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19 and 1.20, the syntax to clear items from a player's inventory is:
/clear [targets] [item] [maxCount]
In Minecraft Java Edition (PC/Mac) 1.8, 1.9, 1.10, 1.11 and 1.12, the syntax to clear items from a player's inventory is:
/clear [targets] [item] [data] [maxCount] [dataTag]
Definitions
- targets is optional. It is the name of the player (or a target selector) whose inventory you wish to clear. If no player is specified, it will default to the player running the command.
- item is optional. It is the item to clear (See list of Minecraft items). If no item is specified, then all items in the player's inventory will be cleared.
- data is optional. It is the data value of the item to clear. It identifies the variation of the block if more than one type exists for that Item ID (See list of data values). Use a value of 0 if no data value exists for the item. If you omit this parameter or use -1 for the data value, the match will be performed on the item only and ignore the data value.
- maxCount is optional. It is the maximum number of items that will be cleared. If you omit this parameter or use -1, all matching items will be cleared.
- dataTag is optional. It is the data tag that you want to set for the item being cleared. It is a compound NBT tag such as {Potion:harming} or {EntityTag:{id:Creeper}}.
Clear Command in Minecraft Pocket Edition (PE)
In Minecraft Pocket Edition, the syntax to clear items from a player's inventory is:
/clear [player] [itemName] [data] [maxCount]
Definitions
- player is optional. It is the name of the player (or a target selector) whose inventory you wish to clear. If no player is specified, it will default to the player running the command.
- itemName is optional. It is the item to clear (See list of Minecraft items). If no item name is specified, then all items in the player's inventory will be cleared.
- data is optional. It is the data value of the item to clear. It identifies the variation of the block if more than one type exists for that Item ID (See list of data values). Use a value of 0 if no data value exists for the item. If you omit this parameter or use -1 for the data value, the match will be performed on the item only and ignore the data value.
- maxCount is optional. It is the maximum number of items that will be cleared. If you omit this parameter or use -1, all matching items will be cleared.
Clear Command in Minecraft Xbox One Edition
In Minecraft Xbox One Edition, the syntax to clear items from a player's inventory is:
/clear [player] [itemName] [data] [maxCount]
Definitions
- player is optional. It is the name of the player (or a target selector) whose inventory you wish to clear. If no player is specified, it will default to the player running the command.
- itemName is optional. It is the item to clear (See list of Minecraft items). If no item name is specified, then all items in the player's inventory will be cleared.
- data is optional. It is the data value of the item to clear. It identifies the variation of the block if more than one type exists for that Item ID (See list of data values). Use a value of 0 if no data value exists for the item. If you omit this parameter or use -1 for the data value, the match will be performed on the item only and ignore the data value.
- maxCount is optional. It is the maximum number of items that will be cleared. If you omit this parameter or use -1, all matching items will be cleared.
Clear Command in Minecraft PS4 Edition
In Minecraft PS4 Edition, the syntax to clear items from a player's inventory is:
/clear [player] [itemName] [data] [maxCount]
Definitions
- player is optional. It is the name of the player (or a target selector) whose inventory you wish to clear. If no player is specified, it will default to the player running the command.
- itemName is optional. It is the item to clear (See list of Minecraft items). If no item name is specified, then all items in the player's inventory will be cleared.
- data is optional. It is the data value of the item to clear. It identifies the variation of the block if more than one type exists for that Item ID (See list of data values). Use a value of 0 if no data value exists for the item. If you omit this parameter or use -1 for the data value, the match will be performed on the item only and ignore the data value.
- maxCount is optional. It is the maximum number of items that will be cleared. If you omit this parameter or use -1, all matching items will be cleared.
Clear Command in Minecraft Nintendo Switch Edition
In Minecraft Nintendo Switch Edition, the syntax to clear items from a player's inventory is:
/clear [player] [itemName] [data] [maxCount]
Definitions
- player is optional. It is the name of the player (or a target selector) whose inventory you wish to clear. If no player is specified, it will default to the player running the command.
- itemName is optional. It is the item to clear (See list of Minecraft items). If no item name is specified, then all items in the player's inventory will be cleared.
- data is optional. It is the data value of the item to clear. It identifies the variation of the block if more than one type exists for that Item ID (See list of data values). Use a value of 0 if no data value exists for the item. If you omit this parameter or use -1 for the data value, the match will be performed on the item only and ignore the data value.
- maxCount is optional. It is the maximum number of items that will be cleared. If you omit this parameter or use -1, all matching items will be cleared.
Clear Command in Minecraft Windows 10 Edition
In Minecraft Windows 10 Edition, the syntax to clear items from a player's inventory is:
/clear [player] [itemName] [data] [maxCount]
Definitions
- player is optional. It is the name of the player (or a target selector) whose inventory you wish to clear. If no player is specified, it will default to the player running the command.
- itemName is optional. It is the item to clear (See list of Minecraft items). If no item name is specified, then all items in the player's inventory will be cleared.
- data is optional. It is the data value of the item to clear. It identifies the variation of the block if more than one type exists for that Item ID (See list of data values). Use a value of 0 if no data value exists for the item. If you omit this parameter or use -1 for the data value, the match will be performed on the item only and ignore the data value.
- maxCount is optional. It is the maximum number of items that will be cleared. If you omit this parameter or use -1, all matching items will be cleared.
Clear Command in Minecraft Education Edition
In Minecraft Education Edition, the syntax to clear items from a player's inventory is:
/clear [player] [itemName] [data] [maxCount]
Definitions
- player is optional. It is the name of the player (or a target selector) whose inventory you wish to clear. If no player is specified, it will default to the player running the command.
- itemName is optional. It is the item to clear (See list of Minecraft items). If no item name is specified, then all items in the player's inventory will be cleared.
- data is optional. It is the data value of the item to clear. It identifies the variation of the block if more than one type exists for that Item ID (See list of data values). Use a value of 0 if no data value exists for the item. If you omit this parameter or use -1 for the data value, the match will be performed on the item only and ignore the data value.
- maxCount is optional. It is the maximum number of items that will be cleared. If you omit this parameter or use -1, all matching items will be cleared.
Examples
- Java
- PE
- Xbox
- PS
- Nintendo
- Win10
- Edu
Example in Java Edition (PC/Mac) 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19 and 1.20
To remove all items from your inventory in Minecraft 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19 and 1.20:
/clear
To clear DigMinecraft's inventory:
/clear DigMinecraft
To clear diamond swords from all players' inventory:
/clear @a diamond_sword
To clear 2 diamond swords from all players' inventory:
/clear @a diamond_sword 2
To remove all diamond swords that are enchanted with Sharpness (any level of this enchantment) from DigMinecraft's inventory:
/clear DigMinecraft diamond_sword{ench:[{id:16}]}
To remove all diamond swords that are enchanted with Sharpness V (only level 5 of this enchantment) from DigMinecraft's inventory:
/clear DigMinecraft diamond_sword{ench:[{id:16,lvl:5}]}
Examples that Check for Items in a Player's Inventory
Finally, you can use the /clear command to check if an item is in a player's inventory. This is done by setting maxCount to 0 in the /clear command.
To check the number of TNT that DigMinecraft has in inventory:
/clear DigMinecraft tnt 0
To check the number of enchanted diamond swords (Sharpness V) each player has in their inventory:
/clear @a diamond_sword{ench:[{id:16,lvl:5}]} 0
Example in Java Edition (PC/Mac) 1.11 and 1.12
To remove all items from your inventory in Minecraft 1.11 and 1.12:
/clear
To clear TNT from all players' inventory:
/clear @a tnt
To clear 10 TNT from all players' inventory:
/clear @a tnt 0 10
To clear red carpet from all players' inventory:
/clear @a carpet 14
To remove all fishing rods that are enchanted with Luck of the Sea (any level of this enchantment) from DigMinecraft's inventory:
/clear DigMinecraft fishing_rod 0 -1 {ench:[{id:61}]}
To remove all fishing rods that are enchanted with Luck of the Sea III (only level 3 of this enchantment) from DigMinecraft's inventory:
/clear DigMinecraft fishing_rod 0 -1 {ench:[{id:61,lvl:3}]}
Examples that Check for Items in a Player's Inventory
Finally, you can use the /clear command to check if an item is in a player's inventory. This is done by setting maxCount to 0 in the /clear command.
To check the number of TNT that DigMinecraft has in inventory:
/clear DigMinecraft tnt 0 0
To check the number of enchanted fishing rods (Luck of the Sea III) each player has in their inventory:
/clear @a fishing_rod 0 0 {ench:[{id:61,lvl:3}]}
Example in Pocket Edition (PE)
To remove all items from your inventory in Minecraft PE:
/clear
To clear DigMinecraft's inventory:
/clear DigMinecraft
To clear iron trapdoors from all players' inventory:
/clear @a iron_trapdoor
To clear 4 iron trapdoors from all players' inventory:
/clear @a iron_trapdoor 0 4
To clear cyan wool from the nearest player's inventory:
/clear @p wool 9
Examples that Check for Items in a Player's Inventory
Finally, you can use the /clear command to check if an item is in a player's inventory. This is done by setting maxCount to 0 in the /clear command.
To check the number of diamond swords that DigMinecraft has in inventory:
/clear DigMinecraft diamond_sword 0 0
Example in Xbox One Edition
To remove all items from your inventory in Minecraft Xbox One Edition:
/clear
To clear TheExcavator's inventory:
/clear TheExcavator
To clear tridents from all players' inventory:
/clear @a trident
To clear 1 trident from all players' inventory:
/clear @a trident 0 1
To clear yellow dye from the nearest player's inventory:
/clear @p dye 11
Examples that Check for Items in a Player's Inventory
Finally, you can use the /clear command to check if an item is in a player's inventory. This is done by setting maxCount to 0 in the /clear command.
To check the number of iron swords that DigMinecraft has in inventory:
/clear DigMinecraft iron_sword 0 0
Example in PS4 Edition
To remove all items from your inventory in Minecraft PS4 Edition:
/clear
To clear DigMinecraft's inventory:
/clear DigMinecraft
To clear shields from all players' inventory:
/clear @a shield
To clear 1 shield from all players' inventory:
/clear @a shield 0 1
To clear red dye from the nearest player's inventory:
/clear @p dye 1
Examples that Check for Items in a Player's Inventory
Finally, you can use the /clear command to check if an item is in a player's inventory. This is done by setting maxCount to 0 in the /clear command.
To check the number of golden apples that DigMinecraft has in inventory:
/clear DigMinecraft golden_apple 0 0
Example in Nintendo Switch Edition
To remove all items from your inventory in Minecraft Nintendo Switch Edition:
/clear
To clear TheEarthMover's inventory:
/clear TheEarthMover
To clear golden swords from all players' inventory:
/clear @a golden_sword
To clear 1 golden_sword from all players' inventory:
/clear @a golden_sword 0 1
To clear birch planks from the nearest player's inventory:
/clear @p planks 1 2
Examples that Check for Items in a Player's Inventory
Finally, you can use the /clear command to check if an item is in a player's inventory. This is done by setting maxCount to 0 in the /clear command.
To check the number of tridents that DigMinecraft has in inventory:
/clear DigMinecraft trident 0 0
Example in Windows 10 Edition
To remove all items from your inventory in Windows 10 Edition:
/clear
To clear Axe2Grind's inventory:
/clear Axe2Grind
To clear levers from all players' inventory:
/clear @a lever
To clear 3 levers from all players' inventory:
/clear @a lever 0 3
To clear magenta carpet from the nearest player's inventory:
/clear @p carpet 2
Examples that Check for Items in a Player's Inventory
Finally, you can use the /clear command to check if an item is in a player's inventory. This is done by setting maxCount to 0 in the /clear command.
To check the number of enchanted golden apples that DigMinecraft has in inventory:
/clear DigMinecraft appleenchanted 0 0
Example in Education Edition
To remove all items from your inventory in Education Edition:
/clear
To clear DigMinecraft's inventory:
/clear DigMinecraft
To clear apples from all players' inventory:
/clear @a apple
To clear 7 apples from all players' inventory:
/clear @a apple 0 7
To clear birch planks from the nearest player's inventory:
/clear @p planks 2
How to Enter the Command
1. Open the Chat Window
The easiest way to run a command in Minecraft is within the chat window. The game control to open the chat window depends on the version of Minecraft:
- For Java Edition (PC/Mac), press the T key to open the chat window.
- For Pocket Edition (PE), tap on the chat button at the top of the screen.
- For Xbox One, press the D-Pad (right) on the controller.
- For PS4, press the D-Pad (right) on the controller.
- For Nintendo Switch, press the right arrow button on the controller.
- For Windows 10 Edition, press the T key to open the chat window.
- For Education Edition, press the T key to open the chat window.
2. Type the Command
In this example, we will remove all items from your inventory with the following command:
/clear
Type the command in the chat window. As you are typing, you will see the command appear in the lower left corner of the game window. Press the Enter key to run the command.
Once the cheat has been entered, your inventory will be cleared:
You will see the message "Cleared the inventory of <Name>, removing xxx items" appear in the lower left corner of the game window to indicate that the inventory was cleared.
Congratulations, you just learned how to use the /clear command in Minecraft!
Advertisements