These are the commands you need to run a Minecraft server: making yourself an operator, managing players, changing the world and shutting down safely. The syntax is for Java Edition 26.3 and Bedrock Dedicated Server, checked against the Minecraft Wiki. Where Bedrock works differently, we say so.
How to use server commands
- In the server console, type commands without the leading slash, for example
op Steve. The console can run every command. - In the game, open chat and start the command with a slash, for example
/gamemode creative. You need to be an operator. - On a hosting panel, use the panel's console tab. It works like the server console.
- Placeholders:
<angle brackets>mark a value you must fill in and[square brackets]an optional one. Leave the brackets out when you type the command.
How to op yourself on a Minecraft server
Open the server console
Start the server and open its console window, or the console tab on your host's panel. Operators cannot be created from inside the game until someone already is one.
Run the op command
Type
op <your name>and press Enter. On Java, use your Minecraft username; you do not need to be online. On Bedrock, use your gamertag while you are connected to the server.Check it worked
In the game, type
/and the list of suggested commands now includes operator commands. To remove operator status later, rundeop <name>.
On Java, op gives the permission level set by op-permission-level in server.properties, which is 4 (everything) unless you change it. To give a moderator a lower level, stop the server and edit their level in ops.json.
| Level | What it adds |
|---|---|
| 1 (Moderator) | Can build inside spawn protection. |
| 2 (Gamemaster) | Gameplay commands such as /gamemode, /give, /tp and /gamerule, plus command blocks. |
| 3 (Admin) | Player management: /kick, /ban, /op and /whitelist. |
| 4 (Owner) | Everything, including /stop and /save-all. |
Bedrock Dedicated Server stores operators in permissions.json. New players get the role in default-player-permission-level (visitor, member or operator). After editing the file, run permission reload; permission list shows who has which role.
Player management commands
| Command | What it does | Level |
|---|---|---|
op <player> | Makes a player an operator. | 3 |
deop <player> | Removes operator status. | 3 |
whitelist add <player> | Lets a player join a whitelisted server. See the whitelist guide. | 3 |
kick <player> [reason] | Disconnects a player. They can rejoin straight away. | 3 |
ban <player> [reason] | Bans a player's account from the server. | 3 |
ban-ip <player or IP> [reason] | Bans an IP address, and anyone connecting from it. | 3 |
pardon <player> | Lifts an account ban. | 3 |
pardon-ip <IP> | Lifts an IP ban. | 3 |
banlist [players|ips] | Lists current bans. | 3 |
list | Shows who is online. | 0 |
transfer <hostname> [port] [players] | Sends players to another server. | 3 |
Game mode, time, weather and world commands
| Command | What it does | Level |
|---|---|---|
gamemode <mode> [player] | Changes your game mode, or another player's, to survival, creative, adventure or spectator. | 2 |
defaultgamemode <mode> | Sets the game mode new players start in. | 2 |
difficulty <level> | Sets the difficulty to peaceful, easy, normal or hard. | 2 |
time set <day|noon|night|midnight> | Sets the time of day. A number of ticks also works, for example time set 1000. | 2 |
weather <clear|rain|thunder> [duration] | Changes the weather. | 2 |
tp <player> <target player> | Teleports a player to another player. Use tp <player> <x> <y> <z> for coordinates. | 2 |
give <player> <item> [count] | Gives items, for example give Steve minecraft:diamond 64. | 2 |
setworldspawn [x y z] | Moves the world spawn to where you stand, or to coordinates. | 2 |
spawnpoint [player] [x y z] | Sets where a player respawns. | 2 |
gamerule <rule> [value] | Changes a game rule, or shows its value if you leave the value out. | 2 |
say <message> | Broadcasts a message to everyone. | 2 |
seed | Shows the world seed. | 2 |
Bedrock uses the same names for these commands, but players need cheats turned on to use them: set allow-cheats=true in server.properties. On Bedrock, time set day moves the clock forward to the next morning instead of setting it back.
Keep inventory and other useful game rules
Game rules change how the world behaves for everyone. Since Java Edition 1.21.11, rule names use underscores, so keep inventory is /gamerule keep_inventory true. On 1.21.10 and older, and in plugins that still expect the old names, use /gamerule keepInventory true. Bedrock names are one lowercase word.
| Java (1.21.11+) | Bedrock | What it does |
|---|---|---|
keep_inventory | keepinventory | Players keep their items and XP when they die. |
players_sleeping_percentage | playerssleepingpercentage | Share of players who must sleep to skip the night. Set 0 so one player is enough. |
mob_griefing | mobgriefing | Set false to stop creepers and other mobs breaking blocks. |
pvp | pvp | Set false to stop players hurting each other. |
advance_time | dodaylightcycle | Set false to freeze the time of day. |
Server console commands
| Command | What it does | Level |
|---|---|---|
stop | Saves the world and shuts the server down cleanly. Use it instead of closing the window. | 4 |
save-all | Saves the world to disk now. Add flush to wait until everything is written. | 4 |
save-off / save-on | Pauses and resumes automatic saving, for example while you copy a backup. | 4 |
whitelist reload | Reloads whitelist.json after you edit it by hand. | 3 |
reload | Reloads data packs. It does not re-read server.properties. On Spigot and Paper it reloads plugins too, which can break them, so restart instead. | 2 |
tick query | Shows the target tick rate and how long ticks are taking, a quick lag check. | 3 |
On Bedrock Dedicated Server, stop works the same. For backups, use save hold, then save query until the files are ready, copy them, and finish with save resume.
If tick query shows ticks taking longer than 50 ms, the server is lagging. Too little memory is a common cause: the server RAM calculator suggests how much to give it for your player count and mods.
Minecraft server commands not working?
- You are not an operator, or your level is too low. Java hides commands you cannot use, so they look unknown. Run
op <name>from the console. - The slash. In chat, commands start with
/. In the console, leave it out. - Old names. Game rule names changed in Java 1.21.11. A guide written for an older version may use the old camelCase name.
- Plugins take over the command. On Paper or Spigot, plugins such as EssentialsX can replace vanilla commands and use their own permissions. Add
minecraft:to run the vanilla version, for example/minecraft:gamemode creative. - Cheats are off on Bedrock. Players cannot run gameplay commands until
allow-cheats=trueis set and the server is restarted.
Friends cannot reach the server at all? That is a network problem, not a command one: see how to port forward a Minecraft server. If nobody can join and players see sign-in errors, check whether Minecraft is down.
Minecraft server command questions
How do I op myself on my Minecraft server?
Open the server console and type op followed by your username, for example op Steve. On Bedrock Dedicated Server you must be connected to the server when you run it.
What is the command to stop a Minecraft server?
Type stop in the server console, or /stop in the game as a level 4 operator. It saves the world before shutting down, so use it instead of closing the window.
How do I turn on keep inventory on my server?
On Java Edition 1.21.11 and newer, run /gamerule keep_inventory true. On older Java versions use /gamerule keepInventory true, and on Bedrock use /gamerule keepinventory true.
How do I ban someone on a Bedrock server?
Bedrock Dedicated Server has no ban command. Turn on the allowlist and remove the player with allowlist remove followed by their gamertag, or use kick to disconnect them.
What permission level do operators get?
On Java, the level set by op-permission-level in server.properties, which is 4 by default. Level 2 covers gameplay commands, 3 adds kicking, banning and the whitelist, and 4 adds stopping and saving the server.
Do vanilla commands work on Paper and Spigot servers?
Yes, but plugins can replace them. Put minecraft: in front of a command, such as /minecraft:give, to run the vanilla version.