Minecraft · Wiki · Command

/gamerule

Changes world rules, for example keepInventory.

TypeCommand

Data checked Oct 21, 2026

The /gamerule command changes the rules of a Minecraft world: whether you keep your inventory when you die, whether the day-night cycle runs, whether mobs can grief blocks, how fast crops grow and dozens more. Game rules are the most powerful way to customize Survival without mods. This command reference covers the syntax in Java and Bedrock, the most useful game rules with their defaults, popular setups and common errors.

Syntax

UseSyntax
Change a rule/gamerule <rule> <value>
Check a rule/gamerule <rule>

Values are either true or false for on/off rules, or a number for rules like randomTickSpeed. Java rule names use camelCase, such as keepInventory, while Bedrock accepts all lowercase, such as keepinventory. Rule names are case-sensitive in Java, so use tab completion to avoid mistakes. Some recent Java versions have renamed or added rules, so autocompletion is the best way to see the exact list for your version.

Most useful game rules

RuleDefaultWhat it does
keepInventoryfalseKeep items and XP after death
doDaylightCycletrueWhether time of day advances
doWeatherCycletrueWhether weather changes naturally
mobGriefingtrueWhether mobs change blocks: creeper holes, endermen moving blocks, villagers farming
doMobSpawningtrueWhether mobs spawn naturally
doFireTicktrueWhether fire spreads and burns out
doInsomniatrueWhether phantoms spawn after nights without sleep
naturalRegenerationtrueWhether health regenerates from a full hunger bar
randomTickSpeed3 (Java), 1 (Bedrock)Speed of crop growth, leaf decay and other random ticks
playersSleepingPercentage100Java: percent of players who must sleep to skip the night
doImmediateRespawnfalseSkip the death screen
showDeathMessagestrueShow death messages in chat
fallDamage, fireDamage, drowningDamage, freezeDamagetrueTurn each damage type on or off
doPatrolSpawning, doTraderSpawningtruePillager patrols and wandering traders
spawnRadius10 (Java), 5 (Bedrock)How far from world spawn new players appear
commandBlockOutput, sendCommandFeedbacktrueCommand messages in chat
showcoordinatesfalseBedrock: show coordinates on screen
pvptrueBedrock: whether players can hurt each other

Popular game rule setups

Keep inventory

/gamerule keepInventory true is the most famous game rule. When you die, you keep your items and experience instead of dropping them. It removes the frustration of losing gear in lava or the void, which makes it popular with casual players and families. Many survival purists consider it a cheat, so decide with your group before turning it on.

Building mode

Set the time to noon, then use /gamerule doDaylightCycle false, /gamerule doWeatherCycle false and /gamerule doMobSpawning false. You get permanent daylight, no rain and no mobs, perfect for long building sessions. Combine with Creative mode or Peaceful difficulty.

No creeper damage

/gamerule mobGriefing false stops creepers, ghasts and the Wither from breaking blocks and endermen from moving blocks. It also stops villagers from harvesting crops, sheep from eating grass, snow golems from leaving snow and some farms from working, so test your farms before keeping it off. In Bedrock, the tntexplodes rule separately controls TNT.

Faster crops

Raising randomTickSpeed makes crops, saplings, sugar cane and grass grow faster, and leaves decay faster. A value of 10 to 20 speeds farming noticeably. Very high values such as 1000 make plants grow almost instantly but also make fire, ice melting and copper oxidation happen extremely fast, which can lag the game. Setting it to 0 stops all random growth.

One-player sleep on servers

In Java, /gamerule playersSleepingPercentage 0 or a low value lets one player skip the night for the whole server. Many small servers set it to 50 so half the players must sleep.

Game rules for map makers

  • doTileDrops and doEntityDrops: stop blocks and entities from dropping items.
  • doMobLoot: stop mob drops.
  • doLimitedCrafting (Java): players can only craft recipes they have unlocked.
  • announceAdvancements: hide advancement messages.
  • reducedDebugInfo: hide coordinates and other details from the F3 screen, so players cannot cheat a maze.
  • maxEntityCramming: limit how many mobs can squeeze into one space before taking damage.
  • disableRaids: turn off raids completely.
  • spectatorsGenerateChunks: stop spectators loading new terrain on servers.

Bedrock world settings

Many Bedrock game rules can be toggled without commands in the world settings menu: Keep Inventory, Daylight Cycle, Weather Cycle, Mob Spawning, Mob Griefing, Fire Spreads, TNT Explodes, Natural Regeneration, Show Coordinates, Show Days Played, Friendly Fire and more. Changing some of these through the menu does not require cheats, but turning on cheats to use /gamerule disables achievements for that world.

Permissions

/gamerule requires cheats in single player or operator permission on servers. Game rules are saved per world and apply to every player and dimension.

Common errors

  • Incorrect argument: the rule name is misspelled or uses the wrong case in Java.
  • Invalid boolean: you typed on or off instead of true or false.
  • Rule seems to do nothing: the rule only exists in one edition, or was renamed in your version.
  • Lag after changing randomTickSpeed: the value is too high; lower it to 3 to 20.

Related commands

/gamerule FAQ

How do you turn on keep inventory?

/gamerule keepInventory true, or the Keep Inventory toggle in Bedrock world settings.

How do you stop creepers destroying blocks?

/gamerule mobGriefing false.

How do you make crops grow faster?

Raise randomTickSpeed, for example /gamerule randomTickSpeed 20.

How do you stop phantoms?

/gamerule doInsomnia false.

Game rules for survival servers

Server owners use game rules to shape the experience. A friendly survival server might turn on keepInventory to reduce frustration, set playersSleepingPercentage to 30 or 50 so a few players can skip the night, and turn off doInsomnia if phantoms annoy players who stay up building. A hardcore-style server keeps every default and might even turn off naturalRegeneration so players must use potions and golden apples to heal. Anarchy servers leave everything on. Because game rules apply to the whole world, it is best to announce changes to players before making them, especially rules that affect deaths and items.

Game rules and farms

Several game rules can quietly break farms. Turning off mobGriefing stops villager farmers from harvesting and replanting crops, stops sheep from regrowing wool by eating grass, and stops snow golem snow trails used in some farms. Turning off doMobSpawning stops every mob farm except spawner farms in some versions. Turning off doFireTick stops lava-based kill chambers that rely on fire spreading. If a farm suddenly stops working on a server, checking the game rules is a good first step.

Checking all game rules

Type /gamerule and press space to see the full list of rules your version supports through autocompletion. In Java, typing a rule name without a value shows its current setting, which is useful when you join a server and want to know whether keepInventory or mobGriefing is on. In Bedrock, most rules are also visible in the world settings screen, so you can review them without commands. Write down any changes you make, because game rules are easy to forget and can confuse other players later.

Resetting game rules

There is no single command to reset every game rule. To return to normal, set each changed rule back to its default value from the table above. In Bedrock, you can review and reset most rules from the world settings menu. Keeping a list of the rules you changed makes this easy, especially on shared worlds and servers where several operators may adjust settings over time.

Most game rules take effect immediately, so you can test a change, see the result and switch it back within seconds.

Game rules also travel with the world save, so a world you download or share keeps its rules.

More about Minecraft

See all