From Minecraft Wiki
Kills entities (players, mobs, items, etc.).
- Java Edition
- Bedrock Edition
kill [target: target]
- player|entity (BE: target: target)
- Fails if player|entity fails to resolve to one or more entities (named players must be online).
- On success, directly kills non-living targets, or inflicts 3.4 x 1038 void damage to living targets — even if they are in Creative mode or protected by a high-level Resistance effect — and issues the appropriate death message. Players and mobs killed this way drop loot, and slimes and magma cubes that aren't already of minimum size spawn smaller ones. Destroys boats, minecarts, loose items and experience orbs if they are targeted.
- To kill yourself:
kill[Bedrock Edition only] or
- To kill the player Bob:
- To kill item entities:
- To kill all entities, including yourself:
- To kill all entities but players: