All commands
๐Ÿ“œ
AdminJava โœ“Bedrock โœ“

/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

Syntax
/gamerule <rule> [value]
commandtargetcoordsvaluerequiredoptional

See it

What it does

keepInventory = falsetrue
Flip a rule that governs the world

Anatomy

Every part, explained

  1. 1
    /gameruleCommandRequired

    Reads or sets a world rule.

  2. 2
    <rule>RuleRequired

    e.g. keepInventory, doDaylightCycle, mobGriefing.

  3. 3
    [value]ValueOptional

    true/false or a number. Omit to check the current value.

Your turn

Try it yourself

Playground
3 tokens ยท press Enter to run

Copy & paste

Examples

/gamerule keepInventory true

Keep your items when you die.

/gamerule doDaylightCycle false

Freeze the sun in place.

/gamerule randomTickSpeed 3

Control how fast crops grow.

Avoid these

Common mistakes

โœ•/gamerule keepinventory true
โœ“/gamerule keepInventory true

Rule names are case-sensitive (camelCase).

โœ•/gamerule keepInventory 1
โœ“/gamerule keepInventory true

Boolean 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

Related commands