I'm building a mini-game on a flat world and slimes are spawning on it. They keep setting off TNT and other traps, forcing me to rebuild every time.

What is a command that I can use to kill all mobs?

  • Just put /kill @e[type=Slime] into a repeat command block?
    – user143228
    Aug 2, 2016 at 19:01

8 Answers 8


Set the difficulty to peaceful in the options menu


Type and enter /gamerule doMobSpawning false


If you're willing to start a new superflat world, you can create custom superflat terrain that doesn't consist of 4 layers. The reason why slimes spawn so often in superflat worlds is because you're actually really close to the void.

If you generate a new superflat world that starts at Y level 64, you won't have any slimes spawn.


If you want to kill every single entity, then do this:

/kill @e

Just slimes? Do this:

/kill @e[type=minecraft:slime]

Don't want the death animation or for them to split? Do this:

/execute at @e[type=minecraft:slime] run tp @e[type=minecraft:slime] ~ -1000 ~

I can't take credit for that last tp command, credit for that goes to ExpertCoder14


Put this in a command block ( /kill @e[type=Slime] ), put the command block on repeat, and then place a redstone block next to it.


There are a variety of ways to stop slimes from spawning in your area:


Do /kill @e to kill all entity including dropped items, started TNTs, arrows, yourself and minecarts.

Do /kill @e[type=minecraft:slime] to kill all slimes.

Do /kill @e[type=!minecraft:player] (not !=) to kill everything that is not a player. Note that this removes started TNTs, arrows, minecarts and dropped items too.


  1. If you only want to kill every living creature except player, do /gamemode peaceful or /gamerule doMobSpawning false as suggested in other answers.
  2. Also suggested by others, if you do not want the slimes to split after killing them or other mobs leaving lots of dropped items on the ground, use /execute at x run tp x ~ -1000 ~ where x is one of @e, @e[type!=minecraft:player] or @e[type=minecraft:slime] or other choices you may choose.
  3. Do kill @e[distance=..r] to kill everything within the radius of r. This can be helpful if you are only playing games in a certain area.


  • These commands are tested in 1.16.4, Java Edition. BUT NOT ANY ELSE VERSIONS.

Put this in a command block:

/kill @e [type = Slime]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .