From Minecraft Wiki
Jump to: navigation, search
Permission level required

2‌[JE only]
1‌[BE only]


Cheat only for some rules‌[BE only]

Sets or queries a game rule value.


  • Java Edition
gamerule <rule name> [<value>]
  • Bedrock Edition
gamerule <rule: BoolGameRule> [value: Boolean]
gamerule <rule: IntGameRule> [value: int]
In Bedrock Edition, gamerules can also be changed in the world options and certain gamerules can be toggled on and off with the command without cheats enabled. This only works in singleplayer, server gamerules and server settings cannot be adjusted using the client settings, even if a player is opped.

The rule names are listed here.


Arguments in Java Edition are case sensitive. Arguments in Bedrock Edition are shown for tab autocompletion as lowercase, but when typed are case-insensitive.

<rule name> (BE: rule: BoolGameRule or rule: IntGameRule)

Specifies the game rule to set or query. Must be one of the predefined game rules; see Game rule.

<value> (BE: value: Boolean or value: int) (optional)

Specifies the value to set the game rule to. Only true or false specified for predefined game rules can affect gameplay, except in the case of maxEntityCramming, randomTickSpeed, spawnRadius, and maxCommandChainLength where any integer 0 or greater affects gameplay; see Game rule.[needs testing]


Fails if the arguments are not specified correctly.

On success, returns the value of the game rule (if <value> is not provided) or sets the game rule to the specified value (if value is provided).


  • To stop the day-night cycle: gamerule doDaylightCycle false
  • To stop natural healing: gamerule naturalRegeneration false
  • To stop creepers, ghasts and other mobs from modifying blocks: gamerule mobGriefing false
  • To stop the natural cycle of weather: gamerule doWeatherCycle false
  • For the player, so that they can keep all of their valuables when they die: gamerule keepInventory true
  • To stop TNT from exploding:‌[BE only] gamerule tntExplodes false


Java Edition
1.4.212w32aAdded /gamerule.
1.814w03aAdded the ability to create custom dummy gamerules.
1.1317w45a/gamerule no longer accepts unknown values (dummy gamerules).
Values to /gamerule are now type-checked.
Pocket Edition
1.0.5alpha /gamerule.
Bedrock Edition
?Command segments rule: BoolGameRule or rule: IntGameRule no longer accept dummy gamerules.

See also[edit]