Keep Inventory Command Minecraft: Master the keepInventory Gamerule
Learn how to use the keepInventory gamerule in Minecraft to control whether players keep items on death, with practical commands, server considerations, and troubleshooting tips.

The keepInventory gamerule decides if players keep their items after death. Use /gamerule keepInventory true to preserve items, or false to drop them. This world-scoped setting works in both Java and Bedrock editions and can be checked with /gamerule keepInventory.
What the keepInventory gamerule does in Minecraft
The keepInventory gamerule controls whether a player's inventory remains after death. If set to true, the player keeps all items they were carrying; if false, items drop as they would in standard death behavior. This is a world-scoped setting that affects all players in the current world and is available in both Java Edition and Bedrock Edition. Understanding this rule is foundational for survival mechanics, server balance, and automation scripts, because it determines how punitive death penalties should be during events or challenges. In Craft Guide's experience, mastering keepInventory is a prerequisite to designing reliable death-handling workflows, especially when you want predictable item retention during tutorials or training worlds.
To inspect or change this value, use simple commands in the in-game chat or on the server console:
/gamerule keepInventory # prints the current value
/gamerule keepInventory true # enable – keep items on death
/gamerule keepInventory false # disable – drop items on deathNotes:
- You need operator privileges to run gamerule commands, and the value applies to the entire world until you flip it again.
- Some servers use command blocks or automation to toggle gamerules during events; be mindful that changes affect all players, not just a single person.
- If you want to verify right after a death, test in a controlled environment by purposely triggering a death in a test world.
Basic usage: enabling and checking the gamerule
To enable keeping inventory on death, run /gamerule keepInventory true. To verify the current state, omit the value: /gamerule keepInventory. You can also query the current value with /gamerule keepInventory to confirm what is active.
/gamerule keepInventory true/gamerule keepInventory/gamerule keepInventory falseTip: Always verify the value after changes, especially on servers where multiple admins may adjust rules.
Understanding scope: global vs per-player modifications
KeepInventory is a world-scoped gamerule. This means the value applies to all players in the loaded world and persists across deaths until you change it again. It is not a per-player setting by default, so individual players cannot toggle this on their own without affecting everyone. Advanced setups on servers can leverage command blocks or the /execute command to simulate per-player behavior in scripted events, but the fundamental rule remains global.
# World-wide change (applies to all players)
/gamerule keepInventory true# Example of conditional application (not truly per-player, but useful for events)
/execute as @a at @s run gamerule keepInventory trueNote: The second example demonstrates how you can scope the effect within a specific event or timed scenario, using the execute command to apply the rule while the rest of the world continues normally.
Practical scenarios: survival on a single-player world vs servers
In single-player worlds, enabling keepInventory can simplify testing and learning by removing the penalty of death, allowing players to experiment with mechanics, farms, or redstone builds without losing progress. For servers and realms, server admins often enable or disable keepInventory to balance challenge levels during events, mazes, or competition ladders. When you want to stage a controlled death scenario, enable the rule at the start of an event and disable it afterward to restore normal difficulty.
Examples:
# Single-player or test world to ease progression
/gamerule keepInventory true# Server event to reduce item loss during a challenge
/ g gamerule keepInventory true# Return to normal survival after an event
/gamerule keepInventory falseCraft Guide recommends testing changes in a copy of your world first, then applying them to production worlds after confirming they behave as expected.
Advanced: conditional application with execute
For admins running events or training scenarios, you might want to toggle keepInventory only during a window of activity. The execute command lets you apply the gamerule in a controlled way for all players during a specific event. This technique is handy for timed challenges or demo days where you want to prevent inventory loss only during that window.
# Enable for all players during a special event
/execute as @a at @s run gamerule keepInventory true# End the event and revert to normal survival rules
/execute as @a at @s run gamerule keepInventory falseIf you need per-player-like control, combine execute with additional conditions (e.g., player location, scoreboard values) to fine-tune when the rule applies. Always document these changes for players so they understand the event rules.
Troubleshooting: permissions, caches, and persistence
If a gamerule change doesn’t seem to take effect, start with the basics: ensure you have operator permissions or are on a single-player world with cheats enabled. Some servers cache rule values at startup; a full restart or world reload may be required for changes to persist. Verify the exact value with /gamerule keepInventory after changes.
Common issues and fixes:
- Command not found: verify you are typing in the correct world and that cheats are enabled on the client or the server console.
- Change not persisting: restart the world or server if your host caches state on startup.
- Conflicting plugins or mods: some plugins override gamerules on load; check plugin configurations for keepInventory interactions.
/gamerule keepInventory true/gamerule keepInventory
Tip: Keep a backup of your world before applying global gamerule changes, especially on public servers with multiple players.
Verification and testing plan
A structured test plan helps ensure that keepInventory behaves as expected under different conditions. Create a dedicated test world or a clone of your production world to perform controlled tests. Steps include: 1) Set keepInventory to true; 2) Die in a safe environment and verify the inventory is retained; 3) Change to false and repeat the test; 4) Revert to a default setting and re-test. Document results and adjust rules based on observations.
/gamerule keepInventory trueTest death in a controlled area:
- Die by lava or /kill (for testing only in a safe zone)
- Confirm items are retained when the rule is true
/gamerule keepInventory falseThen verify items drop on death to confirm the switch took effect.
Steps
Estimated time: 15-25 minutes
- 1
Determine desired behavior
Decide whether you want players to keep items on death for a game mode, event, or testing scenario. Document the intended value (true or false) before changing the world state.
Tip: Plan changes around events and backups to avoid unexpected loss. - 2
Open an authorized session
Join the world with operator privileges or open the server console to run commands. Ensure you are editing the correct world instance.
Tip: On a server, confirm you are editing the intended world (e.g., not a test realm). - 3
Set the gamerule value
Enter the appropriate /gamerule command for the desired behavior. Use true to keep inventory or false to drop it.
Tip: Double-check spelling and spacing to avoid syntax errors. - 4
Verify the change
Run /gamerule keepInventory with and without a value to confirm the new state is active.
Tip: Always verify in-game in the same context as players would experience it. - 5
Test death scenario
In a safe environment, trigger a death (e.g., fall into lava) and observe whether inventory is retained or dropped according to the rule.
Tip: Do not test in a live server during active play sessions. - 6
Document and communicate
Record the final setting and share it with players or team members to avoid confusion during events.
Tip: Clear communication reduces friction during live play.
Prerequisites
Required
- Required
- Operator privileges to run commands (OP on servers)Required
- Backup procedure for worldsRequired
Optional
- Basic familiarity with gamerules and in-game commandsOptional
Commands
| Action | Command |
|---|---|
| Check current valueQuery the current setting (true/false) | /gamerule keepInventory |
| Enable keep inventoryMake players keep items on death (world-wide) | /gamerule keepInventory true |
| Disable keep inventoryPlayers drop items on death (world-wide) | /gamerule keepInventory false |
| Query value (no parameter)Prints current value without specifying true/false | /gamerule keepInventory |
| Conditional apply (event-based)Apply during events or scripted sessions | /execute as @a at @s run gamerule keepInventory true |
People Also Ask
What does the keepInventory gamerule do in Minecraft?
The keepInventory gamerule determines whether players keep their items after death. True preserves inventory, false drops items. It is a world-level setting present in both Java and Bedrock editions, and it persists until you change it again.
The keepInventory gamerule decides if you keep your items after you die, and it applies to the entire world until you flip it again.
Can I enable keepInventory for only certain players?
No direct per-player keepInventory setting exists. It’s a world-level rule. You can approximate per-player control by using execute commands or commands blocks to apply the rule during specific events or to test subsets, but the baseline behavior remains world-wide.
There isn’t a built-in per-player switch; you’d need to script events to apply changes temporarily.
How do I check the current keepInventory value?
Use /gamerule keepInventory with no value to print the current setting. You can also explicitly query via /gamerule keepInventory. This works in both Java and Bedrock editions.
Just run /gamerule keepInventory to see if inventory is kept or dropped.
Will keepInventory persist after restarting the server?
Yes. The keepInventory value is stored as a world gamerule and persists across restarts until you change it again.
Yes, the setting sticks around after a restart unless someone changes it again.
What versions support the keepInventory gamerule?
The keepInventory gamerule exists in Minecraft Java Edition (from 1.13+) and Bedrock Edition. Always verify with your specific version's command syntax if you’re unsure.
It’s supported in both Java and Bedrock editions, since around 1.13 for Java.
The Essentials
- KeepInventory is a world-wide gamerule that controls item retention on death
- Use /gamerule keepInventory true/false to toggle behavior
- Check current state with /gamerule keepInventory
- You can apply temporary changes for events with /execute as @a at @s run gamerule keepInventory true