Minecraft · Guide

How to Turn On Keep Inventory in Minecraft (Java 26.x and Bedrock)

How to turn on keep inventory in Minecraft Java and Bedrock: the current command, the old spelling, the game rules menu, servers and Realms, and what it keeps.

Game Respawned Editorial TeamUpdated November 5, 2026

Losing a full inventory of diamond gear to lava or a creeper is one of the most painful moments in Minecraft. Keep inventory is the game rule that stops it: when it is on, you keep all your items and experience when you die. The command changed recently in Java Edition, which is why many older tutorials no longer work. This guide explains how to turn on keep inventory in Minecraft Java Edition today, the old spelling for older versions, the Bedrock method, and how it works on servers and Realms.

Quick answer: keep inventory command

Edition and versionTurn onTurn off
Java 1.21.11 and newer (including 26.1, 26.2, 26.3)/gamerule keep_inventory true/gamerule keep_inventory false
Java 1.21.10 and older/gamerule keepInventory true/gamerule keepInventory false
Bedrock Edition/gamerule keepinventory true/gamerule keepinventory false

You need cheats turned on, or operator permission on a server, to use the command.

Why the Java command changed

In Java Edition 1.21.11, the Mounts of Mayhem drop released in December 2025, Mojang moved every game rule into a registry and renamed them all from camelCase to snake_case. So keepInventory became keep_inventory, doDaylightCycle became advance_time and randomTickSpeed became random_tick_speed. Java commands are case-sensitive and must match a registered rule, so the old spelling now gives an error. The full ID is minecraft:keep_inventory, but the short form works in the command.

How to turn on keep inventory in Java Edition

Step 1: Turn on cheats

  • New world: set Allow Commands to ON on the Create New World screen.
  • Existing world: press Esc, click Open to LAN, set Allow Commands to ON and start the LAN world.

See how to enable cheats for full details.

Step 2: Type the command

  1. Press T or / to open chat.
  2. Type /gamerule keep_inventory true.
  3. Press Enter. The game confirms that the rule is now set to true.

To check the current setting, type /gamerule keep_inventory with no value. See the /gamerule command page for other rules.

Use the Edit Game Rules menu instead

When you create a new world, open More or the World tab and click Game Rules. Under the Player section, turn on Keep inventory after death. Since Java 26.1, operators can also open a searchable Game Rules screen from World Options in an existing world, so you can toggle it without typing.

How to turn on keep inventory in Bedrock Edition

  1. Edit your world with the pencil icon, or open Settings from the pause menu.
  2. Go to Cheats and turn on Activate Cheats.
  3. In the same section, turn on Keep Inventory.

Or type /gamerule keepinventory true in chat. Bedrock commands are not case-sensitive, so keepInventory also works there. Remember that turning on cheats in Bedrock disables achievements for that world.

Keep inventory on servers and Realms

  • Java server console: type gamerule keep_inventory true without the slash. Game rules apply per world, so on a server with separate dimension worlds you can also run execute in minecraft:the_nether run gamerule keep_inventory true and the same for the End.
  • Java Realms: the owner, or an operator, runs the command in chat.
  • Bedrock Realms: the owner turns on cheats and Keep Inventory in the Realm’s world settings.
  • Hosted servers: many hosting panels have a game rules page with a keep inventory switch.

What keep inventory keeps

  • Every item in your inventory, hotbar, armor slots and offhand.
  • Your experience levels. Normally you drop a part of your XP when you die; with keep inventory you keep all of it and drop none.

It does not keep items with Curse of Vanishing; those still disappear when you die. It also does not protect items in chests, on pets or in shulker boxes you left in the world, and it does not stop items from being destroyed if you throw them into lava or the void yourself.

Should you use keep inventory?

Keep inventory makes the game more relaxed, which is great for building worlds, younger players, playing with friends on a server, or learning hard content like the Warden or the Wither. Many players feel it takes away some of Survival’s tension, because death costs nothing except your position. A good middle ground is to turn it on only while learning a difficult fight, then turn it off again. Hardcore worlds on Java lock the game rules menu, so keep inventory is not available there.

Alternatives to keep inventory

  • Recovery compass: points to where you last died so you can collect your items. See how to make a compass.
  • Ender chest: store valuables before risky trips. See chests and ender chests.
  • Totem of Undying: saves you from one death when held in your hand.
  • Mark your coordinates: the death screen on Java shows your coordinates; note them. See how to see coordinates.

Troubleshooting

  • Incorrect argument for command: you typed keepInventory on a current Java version. Use keep_inventory.
  • Unknown command: cheats are off. Turn them on with Allow Commands or Open to LAN.
  • Still dropping items in the Nether on a server: some server setups store dimensions separately. Run the command in each dimension with execute in.
  • Bedrock toggle missing: turn on Activate Cheats first; the cheat toggles appear below it.

FAQ

What is the keep inventory command in Minecraft Java?

On Java 1.21.11 and newer it is /gamerule keep_inventory true. Older versions use /gamerule keepInventory true.

Why does /gamerule keepInventory not work anymore?

Java renamed all game rules to snake_case in 1.21.11, so the rule is now keep_inventory.

How do you turn on keep inventory without commands?

On Java, use Game Rules when creating a world or the Game Rules screen in World Options. On Bedrock, turn on Keep Inventory in the world’s Cheats settings.

Does keep inventory keep XP?

Yes. You keep all your experience levels as well as your items.

Do you need cheats for keep inventory?

Yes, or operator permission on a server. The game rules menu when creating a world is the exception.

Checked by the Game Respawned editorial team against the current Java and Bedrock versions. Spotted something out of date? Tell us.