Skip to main content
← All Guides
Server Commands

How to Use the /gamemode Command

One command swaps a player between Survival, Creative, Adventure and Spectator. Learn the full syntax, the fast /gm number shortcuts, and how to target other players from the console.

server console, paper 1.21
[Server thread/INFO]: Done (4.812s)! For help, type "help"
/gamemode creative Steve
Set Steve's game mode to Creative Mode
[Steve] is now in Creative Mode
MODE  ·  ALIAS  ·  ID
/gamemodesurvival/gm 0id 0
/gamemodecreative/gm 1← active
/gamemodeadventure/gm 2id 2
/gamemodespectator/gm 3id 3
The four modes
  1. 1
    Open chat or console
    Press T in-game, or use the server console. Commands always start with a slash.
  2. 2
    Type the command
    Enter /gamemode creative to switch yourself. The mode name or its number both work.
  3. 3
    Pick a mode
    survival (0), creative (1), adventure (2) or spectator (3). Use whichever fits.
  4. 4
    Target a player
    Add a name or selector: /gamemode survival Steve, or /gamemode 2 @a for everyone.
  5. 5
    Use the shortcut
    /gm 1 is the EssentialsX alias for creative. /gm 0 is survival. Faster to type mid-game.

What you need

Chat or console
Op permission
/gm shortcut
Player selector

Quick answers

?
What does /gamemode creative do?
It puts the target in Creative Mode: unlimited blocks, flight, instant breaking and no damage.
?
What are the gamemode numbers?
0 = survival, 1 = creative, 2 = adventure, 3 = spectator. Use them like /gamemode 1.
?
Why does the command say I don't have permission?
/gamemode needs op or the minecraft.command.gamemode permission. Run /op YourName from the console first.
?
How do I change someone else's gamemode?
Add their name at the end: /gamemode creative Alex. Use @a to target all players at once.
?
What is the /gm shortcut?
EssentialsX adds /gm as a short alias. /gm c or /gm 1 both set creative; /gm sp sets spectator.
?
What is adventure mode for?
Adventure (2) stops players breaking blocks without the right tool. It is used on maps and minigame servers.
?
What does /gamemode spectator do?
Spectator (3) makes you invisible and lets you fly through blocks. You take no damage and cannot interact with anything. Press a player's name in the menu, or left-click a player, to view from their eyes.
?
What is my default gamemode and how do I change it?
New players join in the world's default mode. Set it with /defaultgamemode survival (or creative). On Java you can also edit level.dat, but the command is safer. This only affects players who have never joined; existing players keep their current mode.
?
Can I switch my own gamemode in single player without cheats?
No. /gamemode needs cheats enabled. Open to LAN from the pause menu and turn Allow Cheats On to use it for that session, or create the world with cheats on. Bedrock has a Game Mode toggle directly in world settings.
?
Why does /gamemode work but /gm does not?
/gm is not vanilla. It is an EssentialsX alias, so it only exists on a Spigot or Paper server with EssentialsX installed. On vanilla, single player, or Realms, use the full /gamemode command.
?
Does changing gamemode keep my inventory?
Yes. Switching modes never clears your inventory. Items picked up in creative stay when you go back to survival. Spectator hides the hotbar but your items are untouched.

Targeting and common mistakes

Selectors decide who the command hits. @s is yourself, @p is the nearest player, @a is every player, and @r is a random one. So /gamemode adventure @a locks the whole server into adventure at once, useful before a map starts.

Order matters: the mode comes first, the target second. /gamemode creative Steve works, /gamemode Steve creative errors. Names are case sensitive on Java, so steve will not match a player called Steve. From the server console there is no "self", so you must always name a target.

  • /gamemode needs op permission level 2 or higher. The level ops get is set in server.properties as op-permission-level (default 4).
  • Spectator on Bedrock arrived in 1.18, older Bedrock builds only have modes 0 to 2.
  • Tab completion shows valid mode names, if creative is not listed your op or cheats are off.
  • Press F3 plus N on Java to toggle between your last mode and spectator instantly.
Hosting
Skip the setup
Get a managed server with one click instead of configuring it all yourself.
Database
Browse every block
Look up any Minecraft item, ID and recipe in the searchable database.