Skip to main content
← All Guides
Server Commands

How to Use /gamerule Commands

Gamerules are world-level switches you flip from the console. One line keeps items on death, another freezes the sun, another stops creepers from cratering your builds. Here are the ones worth changing and the exact syntax.

server console, gamerules
[Server thread/INFO]$/gamerule keepInventory true
keepInventory is now set to: true
[Server thread/INFO]$/gamerule doDaylightCycle false
doDaylightCycle is now set to: false
[Server thread/INFO]$/gamerule mobGriefing false
mobGriefing is now set to: false
[Server thread/INFO]$/gamerule doFireTick false
doFireTick is now set to: false
[Server] 4 gamerules applied · world ruleset saved
The rules worth flipping

Start with the big three: keepInventory true ends gear loss, doDaylightCycle false locks time, and mobGriefing false protects your builds. Good extras are doFireTick false (fire stops spreading), doMobSpawning false for a quiet build world, and randomTickSpeed (default 3) which controls how fast crops grow and fire decays. Run a rule with no value to read it before you change it.

Quick answers

+What is the syntax for gamerule?
/gamerule <rule> [value]. With a value it sets the rule; without one it prints the current value. Booleans take true or false, a few take a number.
+Do gamerules need cheats on?
Yes. You must be an operator or have cheats enabled in the world. On a server, run it from the console or op your account first.
+Does keepInventory affect XP?
Yes. With keepInventory true players keep both their items and experience points on death, and no XP orbs drop.
+How do I freeze time at day?
Run /gamerule doDaylightCycle false, then /time set day. The cycle stops and the sun stays put until you set it again.
+What does mobGriefing false stop?
Creeper and ghast block damage, enderman block pickup, zombies breaking doors, villager farming, and similar world-changing mob behavior. Mobs still attack players.
+Are gamerules per-world?
Yes. Each world stores its own ruleset, so a value you set in one world does not carry over to another.
+What does randomTickSpeed do and is higher safe?
It sets how many random block ticks each chunk section gets per game tick. Default is 3. Crops, fire spread, leaf decay, and grass spread all run on random ticks. Setting it to 0 freezes those processes. Pushing it to 100 or more grows farms fast but hammers the server and can cause lag, so keep it modest on a populated server.
+How do I stop the announce message when a rule changes?
Run /gamerule sendCommandFeedback false to suppress the chat feedback from your own commands, including the gamerule change line. To silence command blocks running commands, run /gamerule commandBlockOutput false so they stop broadcasting to ops.
+Can I limit how far commands like /fill reach?
Yes. maxCommandChainLength (default 65536) caps chained command-block commands. The /fill, /clone, and /fillbiome volume cap is the commandModificationBlockLimit gamerule (default 32768 blocks per command in Java, added in 1.19.4), so you can raise or lower it with /gamerule commandModificationBlockLimit <number>.
+What gamerule controls fall damage and fire damage for players?
There is no single damage rule, but you can stop specific sources. fallDamage, fireDamage, and drowningDamage each take true or false and were added in 1.15; freezeDamage (powder snow) followed in 1.17. Set fallDamage false and players take no damage from drops. All work in current 1.21.x on Java.
+Why does my gamerule reset after a restart?
It does not on a normal world. If a rule keeps reverting, a plugin, datapack, or a startup command in server config is resetting it. Check your scripts and any datapack load functions that run /gamerule on world load.

Rules people get wrong

Rule names are case sensitive. keepInventory works, keepinventory does not, and the console will not autocorrect it. Tab completion gives you the exact spelling, so use it. Booleans are typed as true or false with no quotes.

doDaylightCycle false stops time from advancing but does not set it. Time stays at whatever value it had, so run /time set day (1000 ticks) or /time set noon (6000) right after. The same applies to doWeatherCycle false, which locks the current weather, so clear it first with /weather clear.

doMobSpawning false stops natural spawns but leaves existing mobs alive and does not block spawn eggs, spawners, or breeding. Clear what is already loaded with /kill @e[type=zombie] or similar. On Bedrock the rule names match Java, but a few rules like showDeathMessages behave the same while others are edition only.

  • doInsomnia false stops phantoms spawning from no sleep, better than killing them on sight.
  • doImmediateRespawn true skips the respawn screen so players drop straight back in.
  • spawnRadius 0 pins everyone to the exact world spawn block instead of a 10 block spread.
  • playersSleepingPercentage (default 100) sets the share of players who must sleep to skip night. Set it to 1 so one person can skip for everyone.
Database
Command Reference
Syntax, arguments and examples for every command.
Hosting
Managed Hosting
Skip the setup: a managed server online in minutes.
Database
Item Database
Every item with its stats, IDs, recipes and uses.
Guides
More Server & Admin guides
Run a server: setup, hosting, permissions, worlds and crossplay.