To use a Minecraft command, press T to open chat, type the command with a slash in front, like /time set day, and press Enter. On a server you have to be an operator (OP) first, and in the server console you type the same command without the slash.
This cheat sheet is for Minecraft: Java Edition and was checked against version 26.3. Where older versions use a different name, both are listed.
Most used commands
| Command | What it does |
|---|---|
/tp Luca 100 64 -200 |
Teleports Luca to those coordinates |
/gamemode creative Luca |
Puts Luca in Creative mode |
/give Luca diamond 64 |
Gives Luca 64 diamonds |
/gamerule keep_inventory true |
Players keep their items when they die |
/time set day |
Makes it morning |
/weather clear |
Stops rain and thunder |
/difficulty hard |
Changes the difficulty |
/xp add Luca 30 levels |
Gives Luca 30 levels |
/kill @e[type=zombie] |
Removes every loaded zombie |
/locate structure #village |
Shows the nearest village |
/kick Luca |
Kicks Luca off the server |
/op Luca |
Makes Luca an operator |
How to use commands on a server
Pressing / instead of T opens chat with the slash already typed. While you type, press Tab to fill in command names, players and items.
Most commands only work for operators. Make yourself one with op YourName in the server console, or follow how to give yourself OP.
In the server console, leave the slash out: time set day, not /time set day. The console is not a player, so name the player in commands that would act on you: gamemode creative Luca works there, gamemode creative does not. On an FPS.ms server, open your server at panel.fps.ms and type the command in its console.
Playing single player? Commands work if you turned on Allow Commands when you created the world. On 26.1 and newer you can also turn it on later under World Options in the pause menu.
In the commands below, a word in <angle brackets> is something you fill in, and a part in [square brackets] is optional.
Permission levels
Every command needs a permission level. An operator gets level 4 by default, which covers everything. You can change that with op-permission-level in server.properties.
| Level | Commands |
|---|---|
| 0 | Every player: list and msg |
| 2 | Game commands like gamemode, tp, give, time, gamerule and fill |
| 3 | Player management: kick, ban, op and whitelist |
| 4 | Server management: stop and save-all |
Target selectors
Instead of a player name, you can use a selector:
| Selector | Picks |
|---|---|
@p |
The nearest player |
@a |
All players |
@r |
A random player |
@s |
You, the one running the command |
@e |
All entities: players, mobs, items and more |
@n |
The nearest entity (1.21 and newer) |
Add filters in square brackets: @e[type=zombie] picks only zombies, and @a[distance=..10] picks players within 10 blocks of you. @s picks nothing in the console, because the console is not a player.
For coordinates, ~ means "from where I stand". ~ ~10 ~ is 10 blocks above you.
Player commands
These need level 2, except kick, ban, OP and whitelist, which need level 3.
Teleport command (/tp)
/tp [<player>] <x> <y> <z>
/tp [<player>] <target player>
/tp 100 64 -200teleports you to x 100, y 64, z -200./tp Emmateleports you to Emma./tp Luca Emmateleports Luca to Emma./tp @a @sbrings every player to you./tp ~ ~10 ~lifts you 10 blocks up.
/teleport is the same command with a longer name.
Gamemode command
/gamemode <mode> [<player>]
The modes are survival, creative, adventure and spectator.
/gamemode creativeputs you in Creative./gamemode survival Lucaputs Luca back in Survival./gamemode spectator @amakes everyone a spectator.
Give command
/give <player> <item> [<count>]
/give Luca diamond 64gives Luca 64 diamonds./give @a cooked_beef 16gives every player 16 steak./give @s netherite_pickaxegives you a netherite pickaxe.
Items use their ID, like oak_planks or golden_apple. Press Tab after the player name to browse them.
Keep inventory command
Keep inventory lets players keep their items and XP when they die. It is a game rule, so it is on or off for everyone on the server.
/gamerule keep_inventory true
That is the name on 1.21.11 and newer, including 26.x. On 1.21.10 and older, type /gamerule keepInventory true. Use false to turn it off again, or leave the value out to see the current setting. Not sure which version your server runs? /version tells you on 1.21.6 and newer.
On a hosted server, you can also type it in the console: gamerule keep_inventory true.
Kill command
/kill [<targets>]
/killkills you./kill Lucakills Luca./kill @e[type=zombie]removes every zombie in loaded chunks./kill @e[type=item]clears items lying on the ground.
Never run /kill @e without a filter
@e includes every player, pet, villager and armor stand in loaded chunks.
XP command
/xp add <player> <amount> [levels|points]
/xp set <player> <amount> [levels|points]
/xp add Luca 30 levelsgives Luca 30 levels./xp set Luca 0 levelssets Luca back to level 0./xp query Luca levelsshows Luca's level.
End with levels for levels or points for experience points. /experience is the same command.
Effect command
/effect give <player> <effect> [<seconds>]
/effect clear [<player>] [<effect>]
/effect give Luca night_vision infinitegives Luca night vision until it is cleared. Writeinfiniteinstead of the seconds for an effect that never runs out./effect give @a speed 60 1gives everyone Speed II for 60 seconds. The number after the seconds is the amplifier, which starts at 0, so 1 means level II./effect clear Lucaremoves all of Luca's effects.
Clear and enchant
/clear Lucaempties Luca's inventory./clear Luca dirtremoves only dirt./enchant Luca sharpness 5enchants the item in Luca's hand. The level can't go above the enchantment's normal maximum.
Kick, ban and pardon
/kick <player> [<reason>]
/ban <player> [<reason>]
/pardon <player>
/kick Luca Spamming chatkicks Luca with that message. Luca can join again./ban Luca Griefingbans Luca./pardon Lucalifts the ban./ban-ip Lucabans the IP address Luca plays from, and/pardon-iplifts it./banlistshows every ban.
OP and whitelist
/op Lucaand/deop Lucagive and take operator status. The OP guide covers it step by step./whitelist on,/whitelist add Luca,/whitelist remove Luca,/whitelist listand/whitelist offmanage who can join. See how to whitelist players.
Since 26.3, a new server starts with the whitelist on, so add your friends before they try to join.
World and time commands
All of these need level 2.
Time command (time set day)
/time set <day|noon|night|midnight>
/time set <ticks>
/time add <ticks>
/time set daymakes it morning./time set nightmakes it night./time set 6000is the same as noon. A full day is 24000 ticks.
To keep it day forever, set the time and then stop the clock with /gamerule advance_time false. On 1.21.10 and older, that rule is called doDaylightCycle.
On 26.1 and newer, /time gives an error in the Nether, because the Nether has no clock. Run it from the Overworld.
Weather command (weather clear)
/weather <clear|rain|thunder> [<duration>]
/weather clearstops rain and thunder./weather rainstarts rain./weather thunderstarts a thunderstorm.
To stop the weather from changing on its own, use /gamerule advance_weather false (doWeatherCycle on 1.21.10 and older).
Difficulty command
/difficulty [peaceful|easy|normal|hard]
/difficulty hard sets it to hard. /difficulty without a value shows the current one.
Game rules
Game rules change how the world works. Type /gamerule <rule> <value>. These are the names on 1.21.11 and newer, with the old name for older versions:
/gamerule keep_inventory true: players keep items and XP when they die. Old name:keepInventory./gamerule advance_time false: stops the day and night cycle. Old name:doDaylightCycle./gamerule advance_weather false: stops the weather from changing. Old name:doWeatherCycle./gamerule players_sleeping_percentage 0: one sleeping player skips the night. Old name:playersSleepingPercentage./gamerule mob_griefing false: creepers and endermen can't break or move blocks. Old name:mobGriefing./gamerule spawn_mobs false: no mobs spawn on their own. Old name:doMobSpawning./gamerule immediate_respawn true: players respawn without the death screen. Old name:doImmediateRespawn./gamerule pvp false: players can't hurt each other. This rule exists since 1.21.9.
players_sleeping_percentage is 100 by default, so everyone in the Overworld has to sleep. Set it to 50 to need only half of them.
Seed
/seed shows the world seed, which you can click to copy. To start a new world from a seed, see how to find and change your world seed.
Spawn point and world spawn
/setworldspawn [<x> <y> <z>]
/spawnpoint [<player>] [<x> <y> <z>]
/setworldspawnmoves the world spawn to where you stand. New players start there./setworldspawn 0 64 0moves it to those coordinates./spawnpoint Luca 100 64 -200makes Luca respawn at those coordinates, like a bed would.
Locate command
/locate structure <structure>
/locate biome <biome>
/locate structure #villagefinds the nearest village of any type./locate structure ancient_cityfinds the nearest ancient city./locate biome cherry_grovefinds the nearest cherry grove.
Click the coordinates in chat to get a ready-made /tp command.
World border
/worldborder set <size>
/worldborder center <x> <z>
/worldborder center 0 0centers the border on x 0, z 0./worldborder set 2000makes the playable area 2000 by 2000 blocks./worldborder getshows the current size.
You can add a time to let the border move slowly. On 1.21.11 and newer that time is in ticks, so add an s for seconds: /worldborder set 5000 60s. On older versions the number is already in seconds, so write 60.
Server admin commands
| Command | What it does |
|---|---|
/say Restart in 5 minutes |
Sends a message to everyone (level 2) |
/msg Luca Hi |
Sends Luca a private message (level 0) |
/list |
Shows who is online (level 0) |
/save-all |
Saves the world right away (level 4) |
/save-off |
Pauses autosave, for example while you copy the world (level 4) |
/save-on |
Turns autosave back on (level 4) |
/stop |
Saves the world and stops the server (level 4) |
/reload |
Reloads data packs (level 2) |
/reload does not reload server.properties. Restart the server after changing that file.
Tellraw
/tellraw sends a message in color, without a name in front. It needs level 2.
/tellraw @a {"text":"Welcome!","color":"gold"}
Building commands
All of these need level 2.
Fill command
/fill <from> <to> <block> [<mode>]
<from> and <to> are two opposite corners, each written as x y z. The mode can be hollow, outline, destroy, keep or replace.
/fill ~-5 ~-1 ~-5 ~5 ~-1 ~5 stoneturns the floor around you into an 11 by 11 stone square./fill ~-3 ~ ~-4 ~3 ~4 ~4 stone hollowbuilds a hollow stone box around you./fill 0 60 0 20 70 20 airclears everything between those two corners./fill 0 60 0 20 70 20 gold_block replace dirtreplaces only the dirt.
One fill can change up to 32,768 blocks. For bigger areas, split it into several fills.
Clone command
/clone <from> <to> <destination> [masked]
/clone 0 64 0 10 70 10 100 64 100copies the box between the first two corners and puts the copy's lowest corner at 100 64 100.- Add
maskedat the end to copy only the blocks and skip the air.
Setblock command
/setblock <x> <y> <z> <block>
/setblock ~ ~ ~1 chestplaces a chest next to you./setblock 0 64 0 diamond_blockplaces a diamond block at those coordinates.
Summon command
/summon <entity> [<x> <y> <z>]
/summon zombiespawns a zombie where you stand./summon creeper ~ ~ ~5spawns a creeper 5 blocks away./summon lightning_bolt ~ ~ ~5strikes lightning 5 blocks away.
Want a server to try these on? Make a free Minecraft server on FPS.ms.