How to Keep Inventory When You Die

Guide Java Bedrock

Quick answer: Run /gamerule keep_inventory true (needs cheats) and you keep your items and XP when you die. Turn it back off with /gamerule keep_inventory false. On Bedrock it is also a world toggle: Activate Cheats > Keep Inventory.

What you need

Step by step

  1. Java: open chat (T) and run /gamerule keep_inventory true. The game confirms the rule changed.
  2. No cheats on your Java world? Press Esc > Open to LAN > Allow Cheats: ON, start the LAN world and run the command. The gamerule stays saved in the world even after cheats turn off again.
  3. Bedrock: world settings > Activate Cheats, then scroll to the Keep Inventory toggle and turn it on. Activating cheats disables achievements on that world.
  4. From now on, dying costs you nothing: you respawn with your full inventory and experience levels.
  5. To go back to normal, run /gamerule keep_inventory false (or flip the Bedrock toggle off).
  6. Server owners: the same command works from the server console or as an operator.

Java vs Bedrock

Bedrock hides it behind the cheats toggle, which disables achievements. Java has no achievement lockout - advancements keep working.

Versions: keep_inventory exists in every version that has gamerules - practically all modern Java and Bedrock versions.

Frequently asked questions

Does keep_inventory count as cheating?

It is a built-in game rule Mojang put in the game - on Java it does not even cost you advancements. On Bedrock, any cheat toggle disables achievements for that world.

Do I lose XP with keep_inventory on?

No. You keep your items and your experience levels when you die.

Related:How to Enable Cheats in MinecraftHow to Teleport in Minecraft (Commands and Survival)How to Find Your Way Home in MinecraftCommands