Minecraft Keep Inventory Command (Keep Items When You Die)

keep inventory command, header


This post was last updated on September 1, 2023

Dying in Minecraft is always a pain. Thanks to the death mechanic – you drop all your items when you die. That means you’ve potentially just wasted hours trying to grind all that diamond gear.

We’ve died hundreds of times in Minecraft, which is why we’ve spent time researching the solutions to losing your items.

There are a few ways to protect your items on death – some are more cheaty than others.

This guide shows you how to use the keep inventory command to save your gear and other (cheat-free) methods.

What is the Minecraft Keep Inventory Command?

Using these “cheating codes” to keep your inventory safe is an easy way to improve your gaming experience when playing Minecraft. There’s nothing worse than respawning with an empty inventory and losing all your gear.

The Minecraft keep inventory command is as follows:

“/gamerule keepInventory true”

All you need to do is type this into your chat bar then press enter, and it will change the game rule relating to keeping your inventory on death.

Updating the KeepInventory true command

Now, you will keep your inventory when you die. This includes items in your hotbar, and any other inventory rows.

Use the following methods to open the chat window to run commands based on your platform:

  • On iOs and Android devices (Minecraft Pocket Edition), press the chat icon to open the chat window.
  • For Minecraft Xbox, Playstation, and Nintendo Switch, press the right d-pad button on your console controller to open the chat screen.
  • For PC, Mac, and Linux versions of the Minecraft game (Minecraft Java Edition), simply press the t key on your keyboard.

With that said, there are a few other stages that you might need to go through to get this command to work.

Because commands count as cheat codes, not every single-player or multiplayer world will be compatible without a bit of tweaking.

If you didn’t have cheats enabled when you created your server or survival world, then you’ll have to update the game rules to enable cheats.

Enable Cheats or Commands in Minecraft to Keep Your Inventory When you Die

To enable access to any cheat command in Minecraft, follow these steps.

(Note, it is different for single and multiplayer worlds.)

How to Activate Cheats in Minecraft single-player:

When starting a world, you can select an option to enable cheats. Alternatively, you can adjust the game rules to include the rule “keep inventory on death”.

However, if you didn’t activate these options when you created your world, you can go back and change the settings afterward – even if you’re playing solo.

  1. Open the pause menu using your platform’s dedicated pause key.
  2. From the game menu, click “Open to LAN” to start LAN world. Usually, this function is for letting your friends play in your world.
  3. Click “Allow Cheats:On” to enable cheats
  4. Cheats are now enabled in your single-player world.
keep inventory command, Open To LAN

You will need to repeat this process any time you quit and re-enter your world. The Minecraft world disables cheats any time you disconnect.

Note: While this option remains on, you won’t be able to get any achievements or advancements in the game.

Allow Cheats - On

How to Activate Cheats in Minecraft Multiplayer Games:

If you are playing on a multiplayer server, this process will be quite different.

Ultimately, whether you can use cheat codes in a server depends on your privileges.

You need to have operator status to be able to edit cheats and game rule settings in a server. Only an admin or another operator can give you operator permissions.

Larger servers are very particular about giving operator statuses out, as it can easily be abused and ruin the fun of other players. Maybe if you ask nicely they will activate the keep inventory command, but ultimately it depends on the servers and the staff.

If you are hosting the server, then you automatically have access to commands, so you can simply type in the keep inventory command to make sure all players safely store their inventories on death.

You can use a game rule command to activate players keeping inventory items on death. Otherwise, they will lose inventory items, if you don’t change the game rule.

Supported Platforms to Keep Inventory in Minecraft

The keep inventory command is supported on the following platforms:

  • Minecraft Java Edition
  • Minecraft Bedrock Edition
  • Education Edition
  • Minecraft Pocket Edition App (Minecraft PE).
  • PC
  • Xbox consoles (Xbox one edition, Xbox 360)
  • PS3, PS4, PS5
  • Nintendo Switch
  • Wii U+

These platforms all support cheats too, although some versions have fewer functions.

What Happens to Your Inventory When you Die in Minecraft?

When you die in Minecraft, by default, you drop all your items on the floor in a circle around you. Oh, dear. You’ll then be shown the respawn window which has a quit or respawn button.

When you hit the respawn button your character will come back to life depending on where your spawn location is. This will be either the last bed you slept in or the default spawn position.

This rogue-like feature makes Minecraft more challenging, but in a way, this challenge increases the stakes and makes the game more fun.

After a certain amount of time, your dropped items disappear. So you better get a move on and start collecting all your dropped gear!

How Long do Items Last After Death in Minecraft?

After an item is dropped on the floor in Minecraft (due to death, or otherwise), it will despawn after precisely 5 minutes (6000 ticks). After this time, the items vanish and you cannot get them back.

Is Keeping Your Inventory in Minecraft Cheating?

It depends on how you look at it. Technically, you need cheats codes enabled to be able to activate the keep inventory command – so in that sense, it is a cheat. However, it doesn’t have a huge difference on the gameplay, so you could just say it’s a different play style rather than cheating.

Bearing this in mind, there are actually systems within the game that let you keep your inventory when you die, regardless of whether you have activated cheats or not.

Other Ways to Keep Your Inventory in Minecraft

Besides using cheat codes or changing the game rule settings of your Minecraft world, there is an item that lets you keep your inventory on death, which works in almost the same way as the cheats.

This item is a Totem of Undying.

Holding a Totem of Undying in Minecraft

When equipped in a player’s offhand or main-hand slot, the totem of undying can save a player’s life from fatal damage. Sure, it doesn’t last forever, and if you do die, you will lose your items, however, it gives you a chance of escaping death that otherwise wouldn’t be possible.

The totem’s effect automatically activates when you would otherwise receive a fatal blow.

It starts by instantly restoring half a heart of health, then activating a buff of Regeneration II and Resistance I for 40 seconds. This is paired with 5 seconds of Absorption II. These buffs let you survive and escape the fatal situation you find yourself in. After this time finishes, the totem is destroyed.

You can collect Totems of Undying by killing an Envoker. You can find Envokers in raids and woodland mansions, and they always drop one totem when killed.

The totem works the same in any version and difficulty of Minecraft, including hardcore.


Now you’ve understood the various ways you can keep your items, you won’t need to be so afraid of dying in Minecraft. Thankfully, this command can be used in any version of Minecraft, no matter what type of game mode you are playing.

The only difficult area is activating this command in a multiplayer server where you aren’t an admin – you’ll just have to ask the other admins nicely!


How Do I Keep Inventory Command on a Minecraft Server?

To activate the keep inventory command on a Minecraft server, simply type the following text into the chat bar:

“/gamerule keepInventory true”

Note, you will need to have operator privileges for this to work, so if you aren’t the server host you might have difficulties here.

Why Can’t I turn on Keep Inventory in Minecraft?

If you can’t turn on keep inventory in Minecraft, there could be several reasons for this.

  1. You don’t have cheats enabled in your single-player world (see the above guide to learn how to change this).
  2. You aren’t a server operator – if it isn’t your multiplayer server, you need admin rights to activate this command.
  3. You typed the command wrong.

Read the rest of this guide for more details on how to enable the keep inventory command!