/gamerule
Change how the world behaves - keep items, freeze time, and more.
Overview
What is the /gamerule command?
The /gamerule command toggles world-wide rules that change how Minecraft behaves โ things like keepInventory (keep your items on death), doDaylightCycle (freeze time), mobGriefing (stop creepers destroying blocks) and dozens more.
Run with no value it shows a rule's current setting; add true/false or a number to change it. These rules are some of the most-searched tweaks in the game.
When to use it: Use /gamerule to change how the world works โ keep items on death, stop the day cycle, disable mob griefing, and more.
At a glance
Syntax
/gamerule <rule> [value]See it
What it does
Anatomy
Every part, explained
- 1
CommandRequired/gameruleReads or sets a world rule.
- 2
RuleRequired<rule>e.g. keepInventory, doDaylightCycle, mobGriefing.
- 3
ValueOptional[value]true/false or a number. Omit to check the current value.
Your turn
Try it yourself
Copy & paste
Examples
/gamerule keepInventory trueKeep your items when you die.
/gamerule doDaylightCycle falseFreeze the sun in place.
/gamerule randomTickSpeed 3Control how fast crops grow.
Avoid these
Common mistakes
/gamerule keepinventory true/gamerule keepInventory trueRule names are case-sensitive (camelCase).
/gamerule keepInventory 1/gamerule keepInventory trueBoolean rules want true/false, not 1/0.
Good to know
Frequently asked questions
- How do you keep your inventory after dying?
- Run /gamerule keepInventory true so you no longer drop items and XP when you die.
- How do you stop mobs from spawning?
- Use /gamerule doMobSpawning false to halt natural mob spawning across the world.
- How do you check a gamerule's value?
- Type the rule with no value, e.g. /gamerule keepInventory, and the current setting is printed in chat.
Keep going