Minecraft.How
Loading...
Skip to content
Minecraft command targeting zombies in a limited area

Kill All Mobs in Minecraft: Command Syntax and Practical Uses

Alex Maftei
Alex Maftei
@ice
Updated
11,134 views
TL;DR:For targeted mob removal, use /kill @e[type=zombie]. Java radius: /kill @e[type=zombie,distance=..20]; Bedrock radius: /kill @e[type=zombie,r=20]. Avoid /kill @e[type=!player] on important worlds because it also removes non-mob entities.

Safety first: The Minecraft command /kill @e[type=!player] does not kill only mobs. It targets all non-player entities in loaded areas, including dropped items, pets and decorative objects. To remove a specific mob, use a type filter such as /kill @e[type=zombie]. Use a limited radius where possible and test a copy of your world before destructive commands.

The right command for removing a specific mob

If you only want to remove zombies, enter /kill @e[type=zombie]. This selector targets the zombie entity type rather than every object and animal in the world. The same basic syntax works in Java and Bedrock Edition when you have permission to run commands. It affects matching entities in loaded areas; it cannot reach all mobs saved in unloaded chunks. A command targeting a type also affects named members of that type, so do not use it near a pet or custom mob of the same type without checking.

Java and Bedrock radius examples

To remove only zombies near the command's execution position, use /kill @e[type=zombie,distance=..20] in Java Edition. In Bedrock Edition, use /kill @e[type=zombie,r=20]. Both examples have a 20-block radius but use different selector arguments. The execution position matters: a command typed by a player, run from a command block, or executed from a server command context may use a different origin. Make a backup or test in a separate world before running any bulk cleanup.

Why /kill @e[type=!player] is dangerous

The selector @e refers to entities. The condition type=!player excludes players, but it does not mean only hostile or living mobs. Dropped items, armor stands, item frames, paintings, minecarts, named pets and passive animals can all be included. /kill @e[type=!player] can therefore destroy valuable objects or creations. It is not a safe lag-fix command for a live server. A distance filter only limits the area; it does not protect other kinds of entities. Never promote this selector as a way to kill mobs while preserving everything else.

Can one command target every hostile mob?

There is no single, reliable cross-edition vanilla selector meaning every hostile mob but no other entity. A predictable cleanup is to use one named entity type at a time, for example /kill @e[type=creeper] or /kill @e[type=zombie], and restrict the radius where needed. Java does not accept multiple positive type filters, such as type=zombie,type=skeleton, in a single selector. Bedrock offers families such as family=monster, but category membership should be checked for the actual version and add-ons; it is not a universal guarantee that every desired mob is included and all other entities are excluded.

Misleading commands explained

/kill @e[type=mob] is not a general all-mobs command in vanilla Java. /kill @e[type=!player,tag=Protected] targets entities that have the Protected tag; it does not spare them. Using tag=!Protected instead can exclude tagged entities, but untagged items and pets remain at risk if the broader selection is still used. Similarly, excluding armor stands or cows with type=! does not transform a broad selector into “hostiles only.” Filter each example by what is actually being targeted, and never assume an exclusion list is complete.

Permissions, loaded chunks, and server performance

In single player, commands typically need cheats enabled; on a multiplayer server, operator or equivalent permissions are needed. The kill command can have permanent consequences in survival or creative worlds. On production servers, identify the source of lag before touching entities: excessive mobs, item piles, chunk loading, plugin behavior, redstone and farms require different fixes. Removing many entities is not a substitute for diagnosing server tick performance. A command may also fail or behave differently when your edition, version, plugins or add-ons introduce custom entities.

Alternatives to mass killing

If your aim is to prevent future natural spawns, consider the world rule /gamerule doMobSpawning false, while remembering that it does not disable every possible method of spawning entities. Changing the difficulty to Peaceful also alters the whole world's gameplay and is not a no-impact administrative cleanup. For ordinary survival, spawn-proofing, managing farm overflow, and fixing item-collection systems are often more appropriate. In a shared world, communicate any planned changes and keep a recent backup. A deliberate and limited action is better than a global kill selector.

Sources and further reading

The official Microsoft Bedrock selector reference documents the r radius and entity filters; the Minecraft Wiki command reference compares the Java and Bedrock syntax. The previous article also linked to Minecraft mods and Minecraft PS5 news; those old links remain available but are not evidence for command syntax.

About the author
Alex Maftei
Alex MafteiLead Writer

Lead Writer at Minecraft.How, software developer, and lifelong gamer. I combine hands-on development experience with a passion for gaming and technology. I enjoy exploring new games, experimenting with software, testing mods and tools, and building practical solutions. My writing focuses on sharing real-world experience, technical knowledge, and useful insights with the gaming and developer communities.

Share with your friends!

Frequently Asked Questions

What is the kill all mobs command in Minecraft?
/kill @e[type=!player] targets all non-player entities, not only mobs. It can destroy dropped items, minecarts, armor stands, animals and named pets. Do not use it for safe mob cleanup.
How do I kill only zombies in Minecraft?
Use /kill @e[type=zombie] in Java or Bedrock Edition. It selects zombies in loaded areas, including any named zombies.
How do I kill zombies within 20 blocks in Java?
Use /kill @e[type=zombie,distance=..20]. The distance selector is Java-specific.
What is the Bedrock command for zombies within 20 blocks?
Use /kill @e[type=zombie,r=20]. Bedrock uses the r radius filter.
Does type=!player protect dropped items and armor stands?
No. It protects players from that selector, not other entity types. Restrict the command to the mob type you intend to remove.

Have a Question or Tip about this Guide?Community Q&A

Ask a question or help other players below. Join the discussion and share your Minecraft tips!

Comments

No comments yet. Be the first to share your thoughts!