One player on your server should be allowed to change the weather, another should not. A third asks why /gamemode creative lights up red for them. Neither is a bug – both are permissions, and that is usually the point where commands stop being optional.

Commands let you switch game modes, teleport players, hand out items, change weather and time, or run admin tasks such as whitelist, bans and shutting the server down. In single-player they usually go by the name cheats, because a world only accepts them with "Allow Cheats" switched on – it is the same set of commands. In chat they start with /; in the server console the slash is left out. If you want to set up a server or hand out operator rights first, the basics are in how to create a Minecraft server.

Minecraft commands – a player on an obsidian platform lined with command blocks sends golden arcs of light over a world where the sun shines on one side and a thunderstorm rages on the other

last checked against the official Java Edition documentation, as of August 2026 (version 26.2)

Table of contents

Basics: how commands work

In Minecraft chat, every command starts with a slash:

/gamemode creative

In the server console you leave the slash out:

gamemode creative

This article uses the following notation:

  • <required> marks a required argument.
  • [optional] marks an optional one.

Most commands need cheats enabled in single-player. On a server you need operator rights for many of them. How to make a player an operator with op in the console is covered in how to create a Minecraft server.

Minecraft also supports relative coordinates with ~. So ~ ~1 ~ means one level above whoever runs the command.

/tp @s ~ ~1 ~
Info
Java Edition has used the year.drop.hotfix versioning scheme since December 2025. This article refers to Java Edition 26.2, as of August 2026.

Target selectors

Selectors save you from typing individual player names and let one command hit several targets at once.

SelectorSelects
@pthe nearest player
@aall players
@ra random player
@swhoever runs the command
@eall entities (players, mobs, objects)

Example – put every player into creative mode:

/gamemode creative @a

Example – apply a command to yourself:

/kill @s

You can always use a player name instead of a selector.

Caution
/kill @e hits every entity – not just mobs, but players, armour stands, item frames and villagers too. To clear dropped items only, use the filtered selector /kill @e[type=minecraft:item].

Permission levels

On servers, the operator permission level decides which commands an operator may run.

LevelAllows (examples)
0basic commands such as /help, /me, /tell
1gameplay commands such as /give, /kill
2world commands such as /setblock, /clone, /time – and command blocks
3admin commands such as /ban, /kick, /op, /deop
4full control including /stop and /save-all

The default level for new operators is set with op-permission-level in server.properties. The default value is 4. More on that in Minecraft server.properties explained.

Command list by purpose

The tables below group the most important Minecraft commands by what you actually use them for. The syntax uses <required> for mandatory arguments and [optional] for optional ones.

Game mode, time, weather and difficulty

These commands change fundamental properties of your world or a player: game mode, time of day, weather, difficulty and game rules.

CommandSyntaxEffectExample
gamemode/gamemode <survival/creative/adventure/spectator> [player]set the game mode/gamemode creative @a
time/time set <day/noon/night/midnight/value>set the time of day (0–24000)/time set day
weather/weather <clear/rain/thunder> [duration]set the weather/weather clear
difficulty/difficulty <peaceful/easy/normal/hard>set the difficulty/difficulty hard
gamerule/gamerule <rule> [value]query or set a game rule/gamerule keep_inventory true
seed/seedshow the world seed/seed
Important
Since Java Edition 26.2, /gamerule uses snake_case rule names. To keep your inventory, the command is /gamerule keep_inventory true. Older guides using camelCase names can therefore fail. Every rule is listed in Minecraft game rules.

Players: teleport, items and effects

These commands change position, inventory, experience, effects or spawn points of players and other targets.

CommandSyntaxEffectExample
tp / teleport/tp <target> or /tp <player> <x> <y> <z>teleport/tp @s ~ ~1 ~
give/give <player> <item> [count]give items/give @s <item> 1
kill/kill [targets]kill entities/kill @s
effect/effect give <targets> <effect> [seconds] [level] or /effect clear [targets]grant or clear status effects/effect clear @s
enchant/enchant <targets> <enchantment> [level]enchant the held item/enchant @s <enchantment> 1
experience / xp/experience add <targets> <amount> [levels/points]grant experience (also set/query)/experience add @s 5 levels
clear/clear [player] [item] [count]empty a player's inventory/clear @s
spawnpoint/spawnpoint [player] [x y z]set a personal spawn point/spawnpoint @s
setworldspawn/setworldspawn [x y z]set the world spawn/setworldspawn

Editing the world

World commands set, fill or copy blocks, spawn entities and locate structures or biomes.

CommandSyntaxEffectExample
setblock/setblock <x y z> <block>set a single block/setblock 0 64 0 <block>
fill/fill <x1 y1 z1> <x2 y2 z2> <block>fill an area/fill 0 64 0 10 70 10 <block>
clone/clone <x1 y1 z1> <x2 y2 z2> <target x y z>copy an area/clone 0 64 0 10 70 10 20 64 20
summon/summon <entity> [x y z]spawn an entity/summon <entity> 0 64 0
locate/locate <structure/biome/poi> <name>find the nearest structure or biome/locate biome <name>

In practice:

/fill 0 64 0 10 70 10 <block>

/fill and /clone are limited by the game rule max_block_modifications. The default is 32768 blocks.

Chat and communication

For simple communication, Minecraft offers public, private and action-style messages.

CommandSyntaxEffectExample
say/say <message>message to everyone/say Server restarting shortly
tell / msg / w/tell <targets> <message>private message/tell Penguin Server restarting shortly
me/me <action>action message in third person/me is building at spawn

Server administration

These commands matter most to server operators: whitelist, operators, kicks, bans, saving and a clean shutdown.

CommandSyntaxEffectExample
whitelist/whitelist <on/off/add/remove/list/reload>manage the whitelist/whitelist on
op / deop/op <player> or /deop <player>grant or revoke operator rights/op Penguin
kick/kick <player> [reason]remove a player from the server/kick Alex Restart
ban / pardon/ban <player> [reason] or /pardon <player>ban or unban/ban Penguin Griefing
ban-ip / pardon-ip/ban-ip <ip> or /pardon-ip <ip>ban or unban an IP/ban-ip 203.0.113.7
banlist/banlist <players/ips>show the ban list/banlist players
list/listshow connected players/list
save-all/save-allsave the world immediately/save-all
stop/stopshut the server down cleanly/stop

In chat:

/save-all
/stop

In the server console you type the same commands without the /:

save-all
stop
Important
Shut down with /stop – or stop in the console – instead of closing the server window. The command saves the world cleanly; killing the process risks data loss.

For advanced use there are further commands such as /execute, /scoreboard and /function. They are not covered in detail in this overview.

The most important commands in practice

Teleporting players

For a teleport you can use a player, a selector or coordinates. Relative coordinates with ~ are based on the position of whoever runs the command.

One level up:

/tp @s ~ ~1 ~

Put every player into creative mode:

/gamemode creative @a

Giving items and experience

Items go out with /give, experience with /experience.

/give @s <item> 1
/experience add @s 5 levels

For several players, use @a instead of @s.

Setting time and weather

/time and /weather adjust the environment directly.

/time set day
/weather clear

The time of day accepts the presets day, noon, night and midnight, or a value from 0 to 24000.

Setting game rules (gamerule)

Since Java Edition 26.2, /gamerule uses snake_case instead of the former camelCase rule names.

Keep your inventory after dying:

/gamerule keep_inventory true

If you follow an older guide with a camelCase name and Minecraft does not recognise the rule, check the current spelling. A full overview is in Minecraft game rules.

Using command blocks

You can only get a command block with /give @s minecraft:command_block; it is not in the creative inventory. An operator in creative mode can place and edit it, and it runs commands at permission level 2 — world commands, not admin commands. Whether command blocks work at all is controlled by the command_blocks_work game rule; the old enable-command-block entry in server.properties no longer does anything.

The three types, the redstone and condition switches and worked examples are covered in Minecraft command block.

Shutting the server down cleanly

Save the world and stop the server properly:

/save-all
/stop

In the console:

save-all
stop
Caution
Force-closing the server window risks data loss. For a controlled shutdown, stop is the right way.

Troubleshooting

ProblemLikely cause and fix
"Unknown command"Check for typos, an outdated name or missing permissions.
The command shows red in chat or does nothingCheats may not be enabled in single-player, or you lack operator rights on the server.
/gamerule does not know the ruleSince 26.2, rule names use snake_case. An old camelCase spelling can fail. See Minecraft game rules.
/fill or /clone aborts over too many blocksThe game rule max_block_modifications limits changes to 32768 blocks by default.
/kill @e removed far too much@e selects every entity. For dropped items, use /kill @e[type=minecraft:item].
A command block does nothingThe game rule command_blocks_work is false, or the block gets no redstone signal. enable-command-block in server.properties no longer has any effect.
A command block cannot be editedYou need operator rights and creative mode.
The console ignores /stop with a slashConsole commands are entered without /. Use stop.

Frequently asked questions

How do I become an operator on my Minecraft server?

You become an operator by running op <player> in the server console. Further steps for server setup and operator rights are in how to create a Minecraft server.

How do I teleport to another player?

Use /tp <target> to teleport yourself to another target. You can also move a player to coordinates with /tp <player> <x> <y> <z>.

Why is my command not working?

Usually it is a typo, an outdated name or missing permissions. In single-player most commands need cheats enabled; on a server you need the matching operator permission.

What do @p, @a, @r, @s and @e mean?

@p selects the nearest player, @a all players, @r a random player, @s whoever runs the command, and @e every entity.

How do I change a player's game mode?

Change it with /gamemode <survival/creative/adventure/spectator> [player]. For everyone at once, use /gamemode creative @a.

How do I stop a Minecraft server properly?

Stop it cleanly with /stop in chat or stop in the server console. Beforehand you can force an immediate save with /save-all or save-all.

How do I get a command block?

With /give @s minecraft:command_block — it is not in the creative inventory. Placing and editing one needs operator rights and creative mode, and on a server the game rule command_blocks_work has to be true.

Do these commands work in Bedrock Edition too?

This article covers the Java Edition. In Bedrock Edition, the syntax and the range of commands differ in places.

If you want to use these commands on a server of your own, you can rent a Minecraft server.