Commands let you change the game without mods
Commands in Minecraft PC are text instructions you type into the chat window to alter the game world, change your game mode, teleport, spawn items, and control other players. They work in single-player worlds and multiplayer servers where the owner has enabled them. You open the chat window by pressing the T key (or the key your keyboard layout assigns to chat), type a forward slash followed by the command, and press Enter.
Not every world has commands turned on. In single-player, you need to have cheats enabled when you create the world or open it to LAN. On a server, the owner controls whether commands work. If you try a command and nothing happens, cheats are off—you'll see a message saying "Unknown command" or similar.
Key Takeaways
- Open chat with the T key, type a forward slash, then the command name and any details it needs, then press Enter.
- Single-player worlds need cheats turned on at world creation, or you can enable them later by opening the world to LAN.
- The most common commands are /gamemode (to switch between Survival and Creative), /tp (to teleport), /give (to spawn items), and /time (to change day and night).
- Command syntax is strict—spaces, spelling, and punctuation matter, and the game will tell you what went wrong if you make a mistake.
- Tab autocomplete helps you finish command names and player names without typing them fully.
Enabling cheats in a single-player world
If you created your world without cheats on, you can still enable them. Open the world, press Esc to pause, and look for "Open to LAN" in the pause menu. Click it, then toggle "Allow Cheats" to On, and click "Start LAN World." Your world is now in LAN mode with cheats active. You can use commands until you close the world—the next time you load it, you'll need to open it to LAN again unless you created it with cheats from the start.
To avoid this step in the future, create a new world and look for the "Allow Cheats" toggle before you click Create. It's usually in the "More World Options" section.
The basic command structure and syntax
Every command starts with a forward slash: /. After the slash comes the command name, then any details the command needs, separated by spaces. For example, /gamemode creative switches you to Creative mode. The command name and each detail are called arguments. If you leave out an argument or spell something wrong, the game tells you what's missing.
Minecraft is strict about spelling and spacing. /gamemode creative works, but /gamemode Creative (capital C) does not. Player names must be spelled exactly as they appear in the game. If you're unsure, press Tab after typing part of a name or command—the game will autocomplete it for you.
Some commands let you add extra details in square brackets, which means they're optional. For example, /give @s diamond 64 gives you 64 diamonds, but /give @s diamond gives you just one. The number is optional, so the command works either way.
Common commands and what they do
/gamemode switches between game modes. Type /gamemode creative to enter Creative mode (infinite blocks, no hunger, no damage), /gamemode survival to return to Survival, or /gamemode spectator to fly around and watch without interacting. You can also use the short forms: /gamemode c, /gamemode s, or /gamemode sp.
/tp teleports you or another player. /tp @s 100 64 200 moves you to coordinates X=100, Y=64, Z=200. /tp PlayerName 0 64 0 moves another player to those coordinates. You can also teleport to another player: /tp @s PlayerName brings you to them.
/give spawns items into your inventory or someone else's. /give @s diamond 64 gives you 64 diamonds. /give PlayerName iron_ingot 32 gives another player 32 iron ingots. The item name must be exact—use the name from the creative inventory, with underscores instead of spaces.
/time controls the day-night cycle. /time set day sets it to morning, /time set night sets it to night, and /time set 0 resets it to the exact start of the day. /time add 1000 advances time by 1000 ticks (about 50 seconds).
/weather controls rain and storms. /weather clear stops rain, /weather rain starts it, and /weather thunder starts a thunderstorm.
Using selectors to target players and entities
Instead of typing a player's name, you can use a selector—a shorthand that targets players or creatures automatically. @s means "yourself." @a means "all players." @p means "the nearest player." @r means "a random player." For example, /give @a diamond gives diamonds to everyone on the server, and /tp @p 0 64 0 teleports the nearest player to those coordinates.
Selectors are powerful because they work even if you don't know a player's exact name, and they let you run one command that affects multiple people at once. You can also add filters in square brackets: /give @a[gamemode=survival] apple gives apples only to players in Survival mode.
Finding the exact name of items and blocks
Item and block names in commands are not always what you see in your inventory. Diamonds are diamond, but a diamond pickaxe is diamond_pickaxe (with an underscore). Dirt is dirt, but grass block is grass_block. The safest way to find the right name is to switch to Creative mode, search for the item in the creative inventory, hover over it, and look at the name in the tooltip at the bottom of the screen.
Alternatively, you can look up the item name on the official Minecraft wiki or a command reference site. Names are always lowercase and use underscores instead of spaces.
What to do when a command doesn't work
If you type a command and nothing happens, the game usually shows an error message in red text in the chat window. "Unknown command" means the command name is misspelled or doesn't exist. "Incorrect argument" means you left out something the command needs or spelled an argument wrong. "No targets matched" means the player name or selector didn't find anyone.
Check the spelling of the command name and all arguments, make sure you included the forward slash at the start, and verify that cheats are actually on. If you're targeting a player, confirm their name is spelled exactly right. If you're still stuck, try pressing Tab to autocomplete—the game will show you what it thinks you meant.
Frequently Asked Questions
Can I use commands on a multiplayer server?
Only if the server owner has enabled them. Most public servers turn commands off to prevent griefing. If you own a server or play on a private one, ask the owner to enable cheats in the server settings file (usually called server.properties). Commands work the same way on servers as they do in single-player.
Do commands disable achievements?
Yes. If you use any command in a world, achievements are turned off for that world permanently. You can still play normally, but you won't earn achievement badges. This only affects that specific world—other worlds keep achievements on.
How do I undo a command?
Most commands can't be undone. If you accidentally spawn 1000 items or teleport to the wrong place, you'll need to fix it manually or reload a backup. The safest approach is to save your world before experimenting with commands you haven't used before.
What's the difference between /give and /setblock?
/give puts items into a player's inventory. /setblock places a block in the world at specific coordinates. Use /give to spawn items you can carry, and /setblock to build structures or fill areas with blocks.
Can I see a list of all commands?
Type /help in the chat to see a list of available commands. You can also type /help CommandName to see details about a specific command, including what arguments it needs. The official Minecraft wiki also has a complete command reference.