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
- Cheats enabled (Java: Open to LAN trick works)
- Bedrock: also available as a world toggle in settings
Step by step
- Java: open chat (T) and run /gamerule keep_inventory true. The game confirms the rule changed.
- 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.
- Bedrock: world settings > Activate Cheats, then scroll to the Keep Inventory toggle and turn it on. Activating cheats disables achievements on that world.
- From now on, dying costs you nothing: you respawn with your full inventory and experience levels.
- To go back to normal, run /gamerule keep_inventory false (or flip the Bedrock toggle off).
- 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