keep_inventory
booleanJava 26.2 & Bedrock 26.32Controls whether players keep their items and XP when they die. When true, your inventory and experience are preserved on death — you respawn with everything intact.
Enable keep_inventory
Players keep their entire inventory and all XP on death. No items are dropped, no XP is lost.
Java
/gamerule keep_inventory trueBedrock
/gamerule keepinventory trueBedrock uses keepinventory (all-lowercase, no separators).
Disable keep_inventory
Players drop all items and lose all XP on death (default survival behavior).
Java
/gamerule keep_inventory falseBedrock
/gamerule keepinventory falseDefault: false. Restore with /gamerule keep_inventory false
What keep_inventory does
Controls whether players keep their items and XP when they die. When true, your inventory and experience are preserved on death — you respawn with everything intact.
Frequently asked questions
- Does keep_inventory work on multiplayer servers?
- Yes — if you have OP permissions and cheats are enabled. It applies to all players on the server when set.
- Does keep_inventory work in Bedrock Edition?
- Yes — Bedrock uses /gamerule keepinventory true (all lowercase, no underscore). The behavior is identical.
- Will keep_inventory prevent XP loss too?
- Yes — both your inventory and your experience levels are preserved on death.
- What happened to keepInventory?
- In snapshot 25w44a every Java gamerule was renamed to snake_case. keepInventory is now keep_inventory on Java. Bedrock still uses keepinventory (all lowercase).