The /kill Command in Minecraft: Clear Dropped Items, Mobs and Entities Without Breaking Anything
/kill is for a lot more than killing yourself: it clears the dropped items that cause lag, gets rid of a zombie plague or removes an armor stand that won't break. It's also the command that ruins the most worlds, because a badly written selector takes out pets, villagers and decoration along with everything else. Here's how it's written in Java (the one servers with Paper run), how to count before you delete and how to use it from the server console.
Who can use it
/kill is an operator command (level 2). In a single-player world you need cheats turned on; on a server, being op: in the console type op YourName. A normal player gets “Unknown or incomplete command”.
Typed on its own, /kill kills you. With a selector after it (@e, @a, a name) it kills or removes whatever the selector picks up: that's why everything depends on writing the selector right.
This guide is for Minecraft Java. In Bedrock the radius is written r=10; in Java that's an error and you write distance=..10. If you copy a command from a video and it fails, it's almost always that.
Rather not set it up yourself? Minecraft servers from €6 a month, no contract and a full refund within 72 hours. Or create a free Minecraft server, no card needed.
The ones used most
They all use type: it's what stops the command from taking everything else with it.
Items dropped on the ground
/kill @e[type=item]removes every dropped item in the loaded areas of the world. It's the classic cleanup after a broken farm or an explosion.Experience
/kill @e[type=experience_orb]removes piled-up experience orbs, which in a mob farm can reach the thousands.Stuck arrows
/kill @e[type=arrow]removes the arrows left in the ground and walls around a skeleton farm or after a PvP event.One type of mob
/kill @e[type=zombie]kills every loaded zombie. It works with any entity ID:skeleton,creeper,phantom,slime…One specific dropped item
/kill @e[type=item,nbt={Item:{id:"minecraft:cobblestone"}}]removes only the dropped cobblestone and leaves the rest.The armor stand that won't break
Stand next to it and type
/kill @e[type=armor_stand,distance=..2,limit=1,sort=nearest]: it removes only the one closest to you.
Only near you: distance
distance=..20 limits the command to what's less than 20 blocks from whoever types it. /kill @e[type=item,distance=..20] cleans up around you without touching what others have dropped on the other side of the world.
You can set a minimum and a maximum: distance=10..50 is what's between 10 and 50 blocks away. And with limit=1,sort=nearest it only picks the closest one, the safe way to remove a single thing.
If you don't remember how each option is written, the target selector generator writes it for you and tells you in plain words what it will pick up, with a warning if it grabs too much.
What you should never type
/kill @e without type kills or removes every loaded entity. In Minecraft, players, pets, horses, villagers with their trades, armor stands, item frames with maps, paintings, minecarts and boats are entities too. What you lose that way doesn't come back; only a backup fixes it.
/kill @e[type=!player] is almost as dangerous: it leaves players alone, but takes everything else on the list. If you need to exclude, exclude several at once: /kill @e[type=!player,type=!villager,type=!wolf,type=!cat,type=!horse,type=!armor_stand,type=!item_frame,type=!painting]. Even so, it's safer to kill what's left over one type at a time.
/kill @a kills every connected player, and each one drops their inventory on the ground unless you have gamerule keep_inventory true (that's its name since 1.21.11). Better not to do it as a joke with people building.
Count before you delete
Before a big kill, check how many things the selector picks up without touching them: /execute if entity @e[type=item] answers “Test passed. Count: 312” with the number of items it would remove. Change the selector until the number makes sense and only then run the kill with the same selector.
To protect something you do want to keep, tag it: looking at it up close, /tag @e[type=villager,distance=..10] add keep marks the villagers around you, and /kill @e[type=villager,tag=!keep] removes the rest.
Mobs you kill with /kill drop their loot as if they died any other way (bones, rotten flesh, whatever they were wearing), but no experience. After killing a lot of them, a /kill @e[type=item] in the area picks up what they left behind.
From the server console
In the console it goes without the slash: kill @e[type=item]. The console has no position of its own, so distance counts from the overworld spawn point, not from any player. To clean up near someone, use execute:
Around a player
execute at Ana run kill @e[type=item,distance=..30]removes the items within 30 blocks of Ana, in whatever dimension she's in.In the Nether or the End
execute in minecraft:the_nether run kill @e[type=item]clears the items in the loaded areas of the Nether. Withminecraft:the_end, the ones in the End.If it says “No entity was found”
There was nothing to pick up: either the type is misspelled, or what you're looking for is in an unloaded area (far from every player). /kill only reaches what's loaded.
With EssentialsX and other plugins
EssentialsX has its own /kill, which only kills a player by name (/kill Ana). If you have it installed and the kill with a selector gives a strange error, type the game's version with its prefix: /minecraft:kill @e[type=item].
EssentialsX also has /remove (or /killall), which removes by group within a radius: /remove drops 50 removes the dropped items within 50 blocks; /remove monsters 100, the hostile mobs. It's handy, but /kill with type does the same without a plugin. More of the plugin's commands in the EssentialsX guide.
If what you want is for dropped items to clear themselves every so often to reduce lag, first look at where they come from: it's explained in the ClearLag and entity lag guide.
On NapNodes
Minecraft servers run Paper on the latest version, so everything in this guide works. From the panel's “Console” you make yourself op (op YourName) and can run any kill with execute without being connected.
Before a big kill on a paid server, make a backup in “Backups”: if the selector picked up too much, you go back to how it was. The free server has no backups, so there always count first with execute if entity and limit with distance.
To make the cleanup automatic, in “Advanced settings” → “Scheduled tasks” you create one task that warns the players and, a minute later, another that types kill @e[type=item] in the console (explained in the scheduled tasks guide). And for inventories rather than the ground, there's /clear.
Frequently asked questions
How do I clear dropped items in Minecraft?
With /kill @e[type=item], which removes every dropped item in the loaded areas. To clean up only around you, /kill @e[type=item,distance=..20].
How do I kill all mobs without killing players?
The safe way is one type at a time: /kill @e[type=zombie], /kill @e[type=skeleton]… With /kill @e[type=!player] you also lose pets, villagers, horses and armor stands.
Why doesn't /kill @e[type=item,r=10] work?
Because r= is from Bedrock and very old versions of Java. In today's Java it's written distance=..10.
How do I know how many entities a /kill will remove?
With /execute if entity and the same selector, for example /execute if entity @e[type=item]: it answers with the number of entities it picks up, without removing anything.
Why does /kill say no entity was found?
Because the type is misspelled or because what you're looking for is in an unloaded area. /kill only reaches entities in loaded areas, near some player.
What do I do if EssentialsX won't let me use /kill with @e?
Type /minecraft:kill with the selector: it's the game's command, bypassing EssentialsX's /kill, which only kills players by name.
Shall we set it up for you?
Minecraft servers from €6 a month, never oversold: your RAM is yours alone. And if you'd rather start without paying, there's a free Minecraft server, no card needed.
Your server doesn't show up in the game? Check it in a second with “Is my Minecraft server online?”: players, version and MOTD, free. Need a player's UUID for the whitelist or permissions? Look it up here. Handing out enchanted items? Build the command with the /give generator.
Free tool: Target selector generator. @a, @p, @e or @s with type, distance, name or tag: the selector written right, what it picks in plain English and a warning if it catches too much.
Keep reading
- The /clear Command in Minecraft: Clear an Inventory, Take an Item From Everyone and Count It
How to use /clear in Minecraft Java: empty a player's inventory, take one item from everyone, count what they carry without taking it and why plugins break it.
- The /summon Command in Minecraft: Spawn Mobs With a Name, Gear and Health
How to use /summon in today's Minecraft: named mobs, no AI, babies, armour or more health, riders, the usual errors and how to use it from the console.
- The /give Command in Minecraft: Items With a Custom Name, Enchantments and Lore
How to use /give in today's Minecraft: the component syntax, items with a coloured name, enchantments and lore, the usual errors and the server console.