Command to keep your inventory after dying in Minecraft

No Minecraft player likes to travel to where they died last time and get back their items. If you really hate it too much and you don’t want to keep on doing it, don’t worry because there is a solutiom for this. You just need to change your world’s rules.

To do so, today we will see how to allow cheats in your Minecraft world, how to use commands and what command can help you keeping your items upon death. Let’s start.

minecraft keep inventory command

How to allow cheats

Usually you decide whether you want the cheats to be turned ON or OFF when you create a new Minecraft world (you can check this on New World generation). If you happen to be in a Minecraft world where cheats are not allowed, you can turn them ON following this method:

first open the game menu:

minecraft game menu

then go to Open to LAN. In the menu that you will see, select Allow Cheats: ON

minecraft lan world

then click on Start LAN world. It’s a workaround, but it will do the trick. From now on you will be able to use cheats in your world, even if initially you set it to Allow Cheats: OFF.

If you are playing on a Minecraft online server, you will need to be a level 2 Operator or more to use the cheat to keep the inventory after death. For more information about how to keep the inventory on servers, check the video below.

How to enter the commands

To use the commands you have to press a specific button or key on your keyboard to open them. This button is different depending on the version of Minecraft that you are playing:

  • Education Edition: press T
  • Java Edition: press T
  • Nintendo Switch: press the right arrow button on the controller
  • Pocket Edition (PE): tap on the chat button at the top of the screen.
  • PS4: press the D-Pad
  • Windows 10 Edition: press T
  • Xbox One: press the D-Pad

Then, once the commands are open on the bottom of the screen, you can type whatever you want.

To use cheats you usually have to write specific codes in the commands and press ENTER to execute them.

How to keep the inventory – command

To keep your inventory after you die, you need to turn on the option keepInventory. To do so, open the commands and type:

/gamerule keepInventory true

From now on, every time that you die in that Minecraft world you will respawn with all the items that you were carrying with you. If you don’t trust this information you can try to die while carrying something like a Dirt block to test it, but don’t worry, it 100% works.


This seems to be the only way to keep your inventory without using mods. So make sure that you can use cheats and then use this command to solve the problem. Thank you very much for reading the article this far and I hope I’ll see you again around here. See you and take care!