Updated:

How to write it

VersionKeep items on death
Java 1.21.11 and later/gamerule minecraft:keep_inventory true
Java 1.21.10 and earlier/gamerule keepInventory true
Bedrock Edition/gamerule keepinventory true

On 1.21.11 and later the minecraft: prefix is optional, so /gamerule keep_inventory true also works. Bedrock names are all lowercase with no underscores.

Common game rules

What it doesJava 1.21.11+Java 1.21.10 and earlierBedrock
Keep items on deathkeep_inventorykeepInventorykeepinventory
Stop mobs (creepers etc.) breaking blocksmob_griefingmobGriefingmobgriefing
Stop the day/night cycleadvance_timedoDaylightCycledodaylightcycle
Stop the weather changingadvance_weatherdoWeatherCycledoweathercycle
Stop natural mob spawningspawn_mobsdoMobSpawningdomobspawning
Stop phantomsspawn_phantomsdoInsomniadoinsomnia
Turn off natural health regenerationnatural_health_regenerationnaturalRegenerationnaturalregeneration
Turn off fall damagefall_damagefallDamagefalldamage
Hide death messagesshow_death_messagesshowDeathMessagesshowdeathmessages
Change the share of players who must sleepplayers_sleeping_percentageplayersSleepingPercentageplayerssleepingpercentage
Respawn without the death screenimmediate_respawndoImmediateRespawndoimmediaterespawn
Hide command block output in chatcommand_block_outputcommandBlockOutputcommandblockoutput
Hide command feedbacksend_command_feedbacksendCommandFeedbacksendcommandfeedback
Change crop and plant growth speedrandom_tick_speedrandomTickSpeedrandomtickspeed
Spread of the world spawn pointrespawn_radiusspawnRadiusspawnradius
Blocks drop no itemsblock_dropsdoTileDropsdotiledrops
Mobs drop no lootmob_dropsdoMobLootdomobloot
Stop wardens spawningspawn_wardensdoWardenSpawningnone
Stop pillager patrolsspawn_patrolsdoPatrolSpawningnone
Stop wandering tradersspawn_wandering_tradersdoTraderSpawningnone
Hide advancement messagesshow_advancement_messagesannounceAdvancementsnone
Stop TNT explodingtnt_explodestntExplodes (1.21.2+)tntexplodes
Block limit for fill and clonemax_block_modificationscommandModificationBlockLimit (1.20.3+)none
Players can hurt each other (set false to stop)pvppvp (1.21.9+)pvp
Monsters spawn naturallyspawn_monstersspawnMonsters (1.21.9+)none
Nether portals workallow_entering_nether_using_portalsallowEnteringNetherUsingPortals (1.21.9+)none
Stop fire spreading (set to 0)fire_spread_radius_around_playerdoFireTick (set false)dofiretick
Locator bar showslocator_barlocatorBar (1.21.6+)none
Command blocks workcommand_blocks_workcommandBlocksEnabled (1.21.9+)commandblocksenabled

To disable raids, use /gamerule minecraft:raids false in 1.21.11+ or /gamerule disableRaids true in 1.21.10 and earlier. The new rule flips the meaning of true and false.

The pvp, monster, Nether portal and command block rows replaced the server.properties keys pvp, spawn-monsters, allow-nether and enable-command-block in Java 1.21.9. Older servers still set them in server.properties.

To hide only some players from the locator bar, see locator bar commands.

Most rules take true or false. To turn something off, set it to false, for example /gamerule minecraft:mob_griefing false.

Rules that take a number

Rule (1.21.11+)DefaultExample
players_sleeping_percentage1000 lets one sleeping player skip the night
random_tick_speed3 (Bedrock: 1)Higher values grow crops faster; very high values cause lag
respawn_radius100 makes everyone start at the exact same spot

Rules whose meaning was inverted

disableRaids became raids in 1.21.11, and true and false swapped meaning. To stop raids, older versions use /gamerule disableRaids true; 1.21.11 and later use /gamerule minecraft:raids false. In the same way disableElytraMovementCheck became elytra_movement_check and disablePlayerMovementCheck became player_movement_check, both with inverted values.

Other Bedrock rules

Check the current value

Run the rule without a value, such as /gamerule minecraft:keep_inventory, to print the current setting. Typing /gamerule and waiting a moment shows every rule your version supports, which is the safest way to find the right name.

Common problems

Check your command

The Command Error Doctor flags old camelCase game rule names on 1.21.11 and later and shows the new name.