How to Use Game Commands (Cheats) in Minecraft PC
Updated
Game commands in Minecraft PC let you change the time of day, weather, game mode, summon a mob, give items, and add experience. To use them, cheats must be enabled for the world, and you type the command into the chat window starting with a forward slash (/). If cheats are off, you can temporarily allow them by opening the world to LAN with cheats enabled — but note that this only lasts for that session.
Before You Start: Enable Cheats
Commands only work when cheats are allowed. There are two common ways to get there:
- When creating a new world: turn on the "Allow Cheats" option in the world settings before you generate it.
- On an existing world: open the world to LAN and enable cheats for that session. This does not permanently change the world's settings.
If you type a command and nothing happens or you get an error, the first thing to check is whether cheats are actually enabled.
How to Enter a Command
- Open the chat window (press T by default, or / to open chat with the slash already typed).
- Type the command, starting with
/. - Press Enter to run it.
The expected result is immediate: the game applies the change and usually prints a confirmation in chat. If the syntax is wrong, the game tells you the command failed rather than applying a partial change.
Basic Syntax
A command is a slash, a command name, and then arguments separated by spaces:
/commandName argument1 argument2
Arguments are order-sensitive. For example, /time set day works, but swapping the words around does not.
Changing Time and Weather
Time
/time set day
/time set night
Use /time set followed by the target time. This changes the time of day in the world.
Weather
/weather clear
/weather rain
/weather thunder
Use /weather followed by the condition you want. This changes the weather conditions in the world.
Switching Game Mode
/gamemode creative
/gamemode survival
Use /gamemode followed by the mode name. This switches your game mode. On a multiplayer server you may also need to specify which player the mode applies to.
Summoning Mobs, Giving Items, and Adding Experience
These are the three commands most players reach for, and they map directly to what the DigMinecraft Commands & Cheats section describes: summon a mob, give items, and add experience.
Summon a Mob
/summon <entity>
Use /summon followed by the mob or entity you want to spawn. The mob appears at the targeted location.
Give Items
/give <player> <item> <amount>
Use /give followed by the player, the item, and how many you want. This places the item into that player's inventory.
Add Experience
/xp <amount> <player>
Use /xp followed by the amount of experience and the player who receives it.
When You Want More Control
If you need complex versions of /summon and /give — for example, a mob with specific properties or an item with custom data — DigMinecraft provides Command Generators that build the command for you. The site also covers Command Blocks, which let you program a block to run commands automatically for more complex in-game effects.
Common Problems and How to Fix Them
| Symptom | Likely cause | What to check |
|---|---|---|
| Command does nothing | Cheats are off | Enable cheats when creating the world, or open to LAN with cheats on |
| "Unknown command" error | Typo in the command name | Re-check the spelling right after the slash |
| Command fails on arguments | Wrong order or wrong argument | Confirm the argument order matches the syntax above |
| Works for you but not another player | Missing player argument | Add the target player where the command expects one |
The general troubleshooting rule: read the error the game prints. Minecraft tells you whether the problem is the command name or the arguments, which narrows down what to fix.
Where to Go Deeper
DigMinecraft's Commands & Cheats section is the entry point for learning game commands, and its Command Generators handle the more complex /summon and /give builds. If you want commands to run on their own, the Command Blocks section covers programming a block to do complex things in the game.