October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Remove Items from a Player Inventory or Ender Chest in Minecraft

Use /clear for normal inventories, Java /item replace for Ender Chest slots, and Bedrock /replaceitem for slot-by-slot Ender Chest removal.
WorldMinecraft Length8 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use /clear for a normal player inventory. Java Edition and Bedrock Edition use different command forms, while Ender Chest storage requires slot replacement commands: /item replace in Java and /replaceitem in Bedrock. Select one player first, test a limited quantity, and only then run an all-items or multi-player command.

Choose the command by edition and storage type

The command you need depends on two choices: whether the items are in a player’s ordinary inventory or an Ender Chest, and whether you are playing Java Edition or Bedrock Edition. The commands are not interchangeable.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Goal Java Edition Bedrock Edition
Remove a selected item from a normal inventory /clear <targets> <item> [maxCount] /clear [player] [itemName] [data] [maxCount]
Remove every item from a normal inventory /clear @s (optional arguments omitted) /clear @s
Remove one Ender Chest slot /item replace entity <player> enderchest.<slot> with air /replaceitem entity <player> slot.enderchest <slot> air
Required authority Command permission or operator level Cheats enabled and Game Director/operator permission
Most useful for Exact item counts, command blocks, datapacks and functions Exact item counts and slot-by-slot command-block cleanup

Microsoft describes /clear as clearing items from a player inventory. It is therefore the right tool for ordinary inventory contents, not a general command for Ender Chest slots.

Before running a removal command

Confirm the edition and permissions

In Java Edition, the world must allow commands and the executor needs the appropriate command permission, normally by being an operator. In Bedrock Edition, enable cheats and give the executor Game Director permission. A command that is correctly typed can still fail if the world or player lacks that authority.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Decide how broad the target should be

  • @s means the command executor and is the safest starting target.
  • A player name targets one named player; use the exact in-game name.
  • @a targets every player currently covered by the selector. Do not use it for a test or for a punishment intended for one person.

Use a quantity limit when possible

A maximum count makes a mistake recoverable. If only one stack or a banned item must be removed, specify the item and a count instead of clearing the whole inventory. An all-items command is irreversible unless you have a backup, a rollback system or a known way to restore the contents.

Java Edition: remove items from a normal inventory

Command syntax

Java uses:

/clear [targets] [item] [maxCount]

For example, to remove up to 64 dirt from your own inventory, run:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

/clear @s minecraft:dirt 64

The item identifier should use its namespaced form when available, such as minecraft:dirt. Replace @s with a player name or another selector only after checking the target.

Remove every copy of one item

Specify the item and leave the count unrestricted according to the Java command’s optional-argument behavior. A practical pattern is to use a count large enough for the intended policy, then check the command feedback. If you are enforcing a rule, a count-limited command is safer than an inventory-wide wipe because it cannot affect unrelated item types.

Empty the entire normal inventory

Run:

/clear @s

Use a named player instead of @s when an administrator is removing another player’s contents. Run this only after confirming that the target is correct; the command is designed to clear the player inventory rather than a particular chest block.

What success looks like

Java displays command feedback when a matching item is removed. If the result reports no matching items, check the item identifier, spelling and target. A successful quantity-limited command can remove fewer items than requested when the player owns fewer matching items.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Bedrock Edition: remove items from a normal inventory

Command syntax

Bedrock exposes four positions:

/clear [player: target] [itemName: Item] [data: int] [maxCount: int]

To remove up to 64 dirt from yourself, use:

/clear @s dirt -1 64

Here, -1 fills the data-value position while 64 supplies the maximum number of items. Bedrock’s parser expects those positions in order, so do not omit the data argument while supplying a maximum count.

Clear all ordinary inventory items

Omit the item and the remaining item-specific arguments:

/clear @s

To clear another player, substitute that player’s name for @s. To affect everyone, use @a only when a world-wide wipe is genuinely intended.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Limit the operation to one item and count

Provide the item name and maximum count whenever the objective is narrower than a full wipe. This prevents armor, tools, building blocks and unrelated stacks from being caught by an administrative cleanup. If a command returns an error, confirm that the item name is valid for Bedrock and that all four argument positions are in the expected order.

Java Edition: remove items from an Ender Chest

Why /clear is not the right command

/clear addresses the player inventory. Ender Chest contents are exposed as a separate entity inventory, so Java requires the /item replace command and an Ender Chest slot path.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Clear one slot

Use:

/item replace entity PlayerName enderchest.0 with air

Replace PlayerName with the intended player and change 0 to the slot index you want to empty. The replacement item is air, which removes the stack in that destination slot.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Understand the slot-path form

Java 1.17 introduced item-replacement targets that can address an entity’s Ender Chest slot. Mojang’s published example is:

/item replace block ~ ~ ~ container.0 from entity @s enderchest.0

That example copies an Ender Chest slot into a block container. For deletion, use the same enderchest.<slot> destination on the player and replace it with air, as in the command above.

Clear several selected slots

Run one command for each slot:

  1. Identify the player and the slot index to remove.
  2. Run /item replace entity PlayerName enderchest.<slot> with air.
  3. Repeat for every selected slot.
  4. Open the Ender Chest to verify that only the intended positions changed.

For a recurring cleanup, place the tested commands in a function or command-block sequence. Test with one player and one disposable slot before adding selectors or automation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Bedrock Edition: remove items from an Ender Chest

Use the Ender Chest slot inventory

Bedrock uses the entity inventory slot form:

/replaceitem entity PlayerName slot.enderchest 0 air

The number is the slot index. Replace 0 with the position you want to empty and replace PlayerName with the target player.

Clear a selected group of slots

Bedrock’s method is slot-by-slot. Repeat the command with each required index:

  1. Choose one player rather than @a.
  2. Run /replaceitem entity PlayerName slot.enderchest <slot> air.
  3. Check the Ender Chest in-game.
  4. Repeat for the remaining unwanted slots.

This is less compact than a normal-inventory /clear because the documented /clear form targets player inventory, while Ender Chest storage is addressed through slot.enderchest.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Test before using a broad selector

Run the command against one named player first. Once the slot index and result are confirmed, you can place the command in a command block or repeat it for a controlled set of players. A mistake in the player selector can remove the same slot from every selected player.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Targeting and safety patterns

Self-only commands

Use @s while experimenting. It prevents a command block or chat command from unexpectedly affecting other players and makes it easier to compare the command result with the inventory you can see.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Named-player administration

Use an exact player name when correcting one person’s inventory or Ender Chest. This is preferable to a radius selector when the player may move between command executions.

All-player operations

@a is appropriate only for a deliberate server-wide rule, such as removing a prohibited item from every online player. Pair it with an item and maximum count when possible; an unqualified clear can remove legitimate progress as well as the prohibited object.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Preserve a recovery path

  • Back up the world before a bulk cleanup.
  • Use a limited count for policy enforcement.
  • Run one slot replacement before repeating it across an Ender Chest.
  • Record the exact command used so another administrator can audit or reproduce it.

Troubleshooting command failures

“Unknown command” or permission errors

Verify the edition first: Java’s /item replace syntax is not the Bedrock /replaceitem syntax. In Java, confirm operator or command permission. In Bedrock, enable cheats and grant Game Director permission. If the command is being run from a command block, check that the block can execute commands in the current world.

The command runs but removes nothing

  • Check the target selector or player name.
  • Check the item identifier and spelling.
  • In Bedrock, ensure the data argument is present before maxCount.
  • For Ender Chests, verify that you used the Ender Chest command rather than /clear.
  • Confirm the slot index by testing one known occupied slot.

Only part of the requested quantity disappears

A maximum count is an upper limit, not a promise that the player owns that many matching items. The command removes the available matching quantity up to the specified limit. Check all relevant stacks before assuming that the command failed.

The wrong player or slots were changed

Stop the command block or automation, then inspect the selector and slot number. Replace @a with @s or an exact name during testing. For Ender Chests, execute one slot command at a time until the index mapping is confirmed.

Syntax suggestions differ between versions

Command suggestions can vary with the game edition and version. Treat the edition-specific forms in this guide as separate syntaxes; do not combine Java’s with air wording with Bedrock’s slot.enderchest form or vice versa.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Practical decision guide

Your situation Use Reason
Remove up to 64 dirt from yourself in Java /clear @s minecraft:dirt 64 Item and quantity are explicit.
Remove up to 64 dirt from yourself in Bedrock /clear @s dirt -1 64 Bedrock requires the data-value position.
Empty your ordinary inventory /clear @s Targets the normal player inventory.
Empty Java Ender Chest slot 0 /item replace entity PlayerName enderchest.0 with air Replaces that Ender Chest slot with air.
Empty Bedrock Ender Chest slot 0 /replaceitem entity PlayerName slot.enderchest 0 air Uses Bedrock’s slot-based entity inventory path.

Automating repeated cleanups

Once a command has been verified against one player, it can be moved into a command block, function or datapack workflow appropriate to the edition. Keep the test command separate from the production command, document the selector and slot range, and start with a single execution rather than a repeating block. For normal inventories, an item-specific and count-limited /clear is usually the least destructive automation. For Ender Chests, automation must enumerate the slot replacements you intend to perform.

Do not assume that copying a Java function into Bedrock, or a Bedrock command block into Java, will work unchanged. The inventory target names, argument order and replacement syntax differ by edition.

Key takeaways

  • Use /clear for ordinary player inventory contents.
  • Use Java’s /item replace ... enderchest.<slot> with air for selected Ender Chest slots.
  • Use Bedrock’s /replaceitem entity ... slot.enderchest <slot> air for selected Ender Chest slots.
  • Start with @s or one named player, then expand only after the result is verified.
  • Prefer an item and maximum count whenever a complete inventory wipe is not required.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.