How to Keep Inventory in Minecraft after dying using command

Minecraft, at its core, is a survival sandbox game as most of its player base mainly plays in survival game mode. Like many other survival video games, the items you carry lose when you die in Minecraft.

You can always collect these items later. However, if you die in lava or while exploring a new area you are unfamiliar with, those items become irretrievable. Fortunately, Minecraft has a game rule called “keepInventory” to protect your items.  

This guide will tell you how to not lose inventory after dying in Minecraft.

Using commands to keep inventory in Minecraft


Before we get started, we need to make sure that cheats are enabled for commands to work. If you are creating a new world, you can allow cheats from the “Create New World” screen.

If you want to enable it on an existing world in Java Edition, open the world, then press the escape button. On the pause menu, click on “Open to LAN” and click on “Allow Cheats”. Then, select “Start LAN World”. Similarly, Bedrock Edition players also have to enable cheats t

After enabling cheats, open the chat window. To keep your inventory items even after you die, type “/gamerule keepInventory true” and press enter. Now, items will stay in inventory as they were before you died. The command is the same for all editions of Minecraft.

Players often turn on this feature to use it as a backup plan for when they get lost while exploring or want to return home after a long mining or exploration session.

Useful Minecraft commands

Here’s a list of a few more Minecraft commands that may come in handy:

  • /tp or /teleport: As you can guess, this command is used to teleport any player or entity to specific coordinates.
  • /give: This command gives you the item you specify.
  • /difficulty: You can use this command to change the difficulty of an already created Minecraft world.
  • /gamemode: This command allows you to switch to any game mode you want.
  • /locate: Using the locate command, you can find the exact coordinates of a specific biome or structure. This command always returns coordinates of the structure or biome that is the closest.

This wraps up our guide to keep inventory gamerule in Minecraft. Check out our other helpful Minecraft guides:

Leave a Comment