News
Game
Guides
Downloads
Versions
/gamerule
COMMANDS WORLD & RULES CHEATS · LEVEL 2 Added in 1.14 or earlier

/gamerule command in Minecraft

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.

Syntax

/gamerule <rule> [<value>]
ArgumentExpectsWhat it does
ruleGame ruleRule name in snake_case, e.g. keep_inventory, mob_griefing or advance_time. All rules are listed further down this page.
valueoptionaltrue / false or a numbertrue or false for switches, a whole number for counters. Leave it out to read the current value.
All 2 forms
  • /gamerule <rule>
  • /gamerule <rule> <value>

Examples

Keep your items on death

/gamerule keep_inventory true

Players keep their inventory and experience when they die.

Java 26.3
After a real death and respawn with keep_inventory set to true, all 36 inventory slots are still full In-game screenshot · Java Edition 26.3

Stop mobs breaking blocks

/gamerule mob_griefing false

Creeper explosions no longer destroy blocks and Endermen stop picking them up.

Java 26.3

Skip the night with half the players

/gamerule players_sleeping_percentage 50

The night ends once half of the online players are in bed.

Java 26.3

Check the value of a rule

/gamerule keep_inventory

Prints the current value without changing anything.

Java 26.3

Freeze the time of day

/gamerule advance_time false

The sun and moon stop moving until you set the rule back to true.

Java 26.3
Interactive tool

Command generator

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 true

Calculated from the Java Edition 26.3 game files

All game rules

RuleValue
advance_timetrue / false
advance_weathertrue / false
allow_entering_nether_using_portalstrue / false
block_dropstrue / false
block_explosion_drop_decaytrue / false
command_block_outputtrue / false
command_blocks_worktrue / false
drowning_damagetrue / false
elytra_movement_checktrue / false
ender_pearls_vanish_on_deathtrue / false
entity_dropstrue / false
fall_damagetrue / false
fire_damagetrue / false
fire_spread_radius_around_player-1+
forgive_dead_playerstrue / false
freeze_damagetrue / false
global_sound_eventstrue / false
immediate_respawntrue / false
keep_inventorytrue / false
lava_source_conversiontrue / false
limited_craftingtrue / false
locator_bartrue / false
log_admin_commandstrue / false
max_block_modifications1+
max_command_forks0+
max_command_sequence_length0+
max_entity_cramming0+
max_minecart_speed1 … 1000
max_snow_accumulation_height0 … 8
mob_dropstrue / false
mob_explosion_drop_decaytrue / false
mob_griefingtrue / false
natural_health_regenerationtrue / false
player_movement_checktrue / false
players_nether_portal_creative_delay0+
players_nether_portal_default_delay0+
players_sleeping_percentage0+
projectiles_can_break_blockstrue / false
pvptrue / false
raidstrue / false
random_tick_speed0+
reduced_debug_infotrue / false
respawn_radius0+
send_command_feedbacktrue / false
show_advancement_messagestrue / false
show_death_messagestrue / false
spawn_mobstrue / false
spawn_monsterstrue / false
spawn_patrolstrue / false
spawn_phantomstrue / false
spawn_wandering_traderstrue / false
spawn_wardenstrue / false
spawner_blocks_worktrue / false
spectators_generate_chunkstrue / false
spread_vinestrue / false
tnt_explodestrue / false
tnt_explosion_drop_decaytrue / false
universal_angertrue / false
water_source_conversiontrue / false

Rule names in 26.3

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.

Rules and world settings

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

/gamerule: FAQ

Why does /gamerule keepInventory not work anymore?

Rule names now use snake_case. Write /gamerule keep_inventory true instead, the old spelling is no longer accepted.

Do game rules apply to all players?

Yes. A rule applies to the whole world, for every player and every dimension. There is no per-player setting.

How do I use /gamerule?

Type it in the chat with cheats on: /gamerule <rule> [<value>].

Who can use /gamerule?

Cheats on, or operator level 2.

Copy & paste lists with /gamerule

Related commands