Losing your items when you die in Minecraft makes a bad trip worse. Turn on Keep Inventory through chat or your world's settings to keep them after death. These steps cover Java Edition 26.2, and the command works in versions 1.21.11 through 26.2.
Turn on Keep Inventory with a command
With commands enabled or sufficient operator permissions, enter the rule directly in chat.
- 1.Press T to open chat.
- 2.Enter
/gamerule minecraft:keep_inventory trueand press Enter. - 3.Enter
/gamerule minecraft:keep_inventoryand press Enter to confirm that the value istrue.
Enable commands in an existing singleplayer world
If your world has commands disabled, Java 26.2 puts the host's Allow Commands toggle in the pause menu. Enable it there to unlock the game-rule editor and change Keep Inventory without typing a command.
Press Esc, then select World Options.... Set Allow Commands to ON. Open Edit Game Rules... and enable Keep inventory after death. Select Done.
The Game Rules screen includes a search field in versions 26.1 and later. The in-game editor requires operator permissions and is unavailable in Hardcore; the 26.2 singleplayer command toggle is also unavailable in Hardcore.
Older tutorials use the rule name keepInventory or send the host through Open to LAN. The rule name changed to minecraft:keep_inventory in 1.21.11. In 26.2, use World Options... → Allow Commands for the host; the LAN controls under Settings for Other Players configure joining players.
Ask the server or Realm owner to enable it
If you lack permission to change game rules, ask the server or Realm owner to enable Keep Inventory.
As the owner or an authorized operator, join the world. Press T to open chat, then enter /gamerule minecraft:keep_inventory true. Press Enter to apply the rule.
Tip: Keep Inventory belongs to the world or server, so your local singleplayer settings do not change it for a world you join.
Set it before creating a new world
You don't need to enable commands to set Keep Inventory during world creation.
- 1.Select Singleplayer, then Create New World.
- 2.Open More, then Game Rules.
- 3.Find Keep inventory after death and enable it.
- 4.Select Done, then Create New World.
Fix different behavior between dimensions
Setting each dimension's rule fixes Keep Inventory being enabled in only part of a Bukkit, Paper, or Spigot server.
As an operator, open chat with T. For the Overworld, submit /execute in minecraft:overworld run gamerule minecraft:keep_inventory true with Enter. For the Nether, submit /execute in minecraft:the_nether run gamerule minecraft:keep_inventory true with Enter. For the End, submit /execute in minecraft:the_end run gamerule minecraft:keep_inventory true with Enter.
Use the console when you manage the server
A dedicated-server console lets you change Keep Inventory without joining the game. This command syntax applies to Java servers running versions 1.21.11 through 26.2.
Open your running server's console. Its location in the hosting panel depends on your provider. Submit gamerule minecraft:keep_inventory true without the leading slash used in chat. If the console method fails, join the world as an authorized operator, then enter /gamerule minecraft:keep_inventory true in chat and press Enter.
Frequently Asked Questions
Does Keep Inventory also save experience?
Yes. The rule retains your experience as well as your items after death.
How do I turn Keep Inventory off again?
With commands enabled or sufficient operator permissions, enter /gamerule minecraft:keep_inventory false in chat and press Enter.
Do I need a mod or download to enable Keep Inventory?
No. Minecraft Java includes the game rule and the controls needed to enable it. No download or installation is required.
Can I use the shorter keep_inventory command?
Yes. In Java versions 1.21.11 through 26.2, /gamerule keep_inventory true also works.