Keep your items on death
/gamerule keep_inventory truePlayers keep their inventory and experience when they die.

The /gamerule command reads or changes the rules of a world: keeping your inventory on death, mob griefing, the day cycle, phantoms, the sleep percentage and many more. One command changes the rule for every player and every dimension of the world.
/gamerule <rule> [<value>]| Argument | Expects | What it does |
|---|---|---|
| rule | Game rule | Rule name in snake_case, e.g. keep_inventory, mob_griefing or advance_time. All rules are listed further down this page. |
| valueoptional | true / false or a number | true or false for switches, a whole number for counters. Leave it out to read the current value. |
/gamerule keep_inventory truePlayers keep their inventory and experience when they die.
/gamerule mob_griefing falseCreeper explosions no longer destroy blocks and Endermen stop picking them up.
/gamerule players_sleeping_percentage 50The night ends once half of the online players are in bed.
/gamerule keep_inventoryPrints the current value without changing anything.
/gamerule advance_time falseThe sun and moon stop moving until you set the rule back to true.
Fill in the fields, copy the command, paste it in the chat. Syntax checked against Java Edition 26.3.
Turn on JavaScript to use the interactive version.
/gamerule keep_inventory trueCalculated from the Java Edition 26.3 game files
| Rule | Value | |
|---|---|---|
| advance_time | true / false | |
| advance_weather | true / false | |
| allow_entering_nether_using_portals | true / false | |
| block_drops | true / false | |
| block_explosion_drop_decay | true / false | |
| command_block_output | true / false | |
| command_blocks_work | true / false | |
| drowning_damage | true / false | |
| elytra_movement_check | true / false | |
| ender_pearls_vanish_on_death | true / false | |
| entity_drops | true / false | |
| fall_damage | true / false | |
| fire_damage | true / false | |
| fire_spread_radius_around_player | -1+ | |
| forgive_dead_players | true / false | |
| freeze_damage | true / false | |
| global_sound_events | true / false | |
| immediate_respawn | true / false | |
| keep_inventory | true / false | |
| lava_source_conversion | true / false | |
| limited_crafting | true / false | |
| locator_bar | true / false | |
| log_admin_commands | true / false | |
| max_block_modifications | 1+ | |
| max_command_forks | 0+ | |
| max_command_sequence_length | 0+ | |
| max_entity_cramming | 0+ | |
| max_minecart_speed | 1 … 1000 | |
| max_snow_accumulation_height | 0 … 8 | |
| mob_drops | true / false | |
| mob_explosion_drop_decay | true / false | |
| mob_griefing | true / false | |
| natural_health_regeneration | true / false | |
| player_movement_check | true / false | |
| players_nether_portal_creative_delay | 0+ | |
| players_nether_portal_default_delay | 0+ | |
| players_sleeping_percentage | 0+ | |
| projectiles_can_break_blocks | true / false | |
| pvp | true / false | |
| raids | true / false | |
| random_tick_speed | 0+ | |
| reduced_debug_info | true / false | |
| respawn_radius | 0+ | |
| send_command_feedback | true / false | |
| show_advancement_messages | true / false | |
| show_death_messages | true / false | |
| spawn_mobs | true / false | |
| spawn_monsters | true / false | |
| spawn_patrols | true / false | |
| spawn_phantoms | true / false | |
| spawn_wandering_traders | true / false | |
| spawn_wardens | true / false | |
| spawner_blocks_work | true / false | |
| spectators_generate_chunks | true / false | |
| spread_vines | true / false | |
| tnt_explodes | true / false | |
| tnt_explosion_drop_decay | true / false | |
| universal_anger | true / false | |
| water_source_conversion | true / false |
Rules use lowercase names with underscores: keep_inventory, mob_griefing, advance_time, advance_weather, spawn_phantoms. Older guides show the previous camel case names, which the game now rejects. Tab completion lists every valid rule.
Switches take true or false. Number rules have limits, for example max_snow_accumulation_height goes from 0 to 8. A rule without a value answers "Game rule ... is currently set to ...".
keep_inventory: keep items and experience after death.mob_griefing: false stops a Creeper from breaking blocks and an Enderman from taking them.players_sleeping_percentage: share of players who must sleep to skip the night.random_tick_speed: speed of crop growth and other random updates, 3 by default.spawn_phantoms: false stops Phantom spawns.spawn_monsters: false stops natural monster spawns without switching to Peaceful.When you create a world, the Game Rules screen sets the same values without commands. Rules are saved with the world, so they stay after a restart. For a custom survival setup, combine them with /difficulty and /time.
✓ Checked in Java Edition 26.3 · updated 2 November 2026
Rule names now use snake_case. Write /gamerule keep_inventory true instead, the old spelling is no longer accepted.
Yes. A rule applies to the whole world, for every player and every dimension. There is no per-player setting.
Type it in the chat with cheats on: /gamerule <rule> [<value>].
Cheats on, or operator level 2.