---
title: "Minecraft Commands: Cheat Sheet for Server Owners"
description: "Minecraft commands for running a server, with copy-paste examples for teleport, gamemode, give and keep inventory. Plus time, weather and bans."
url: https://fps.ms/blog/minecraft-commands
---
# Minecraft Commands: Cheat Sheet for Server Owners

Published 2026-11-09.

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](https://fps.ms/docs/minecraft/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](https://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](https://fps.ms/docs/minecraft/minecraft-server-properties-explained).

| 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)

```text
/tp [<player>] <x> <y> <z>
/tp [<player>] <target player>
```

- `/tp 100 64 -200` teleports you to x 100, y 64, z -200.
- `/tp Emma` teleports you to Emma.
- `/tp Luca Emma` teleports Luca to Emma.
- `/tp @a @s` brings every player to you.
- `/tp ~ ~10 ~` lifts you 10 blocks up.

`/teleport` is the same command with a longer name.

### Gamemode command

```text
/gamemode <mode> [<player>]
```

The modes are `survival`, `creative`, `adventure` and `spectator`.

- `/gamemode creative` puts you in Creative.
- `/gamemode survival Luca` puts Luca back in Survival.
- `/gamemode spectator @a` makes everyone a spectator.

### Give command

```text
/give <player> <item> [<count>]
```

- `/give Luca diamond 64` gives Luca 64 diamonds.
- `/give @a cooked_beef 16` gives every player 16 steak.
- `/give @s netherite_pickaxe` gives 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.

```text
/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

```text
/kill [<targets>]
```

- `/kill` kills you.
- `/kill Luca` kills Luca.
- `/kill @e[type=zombie]` removes every zombie in loaded chunks.
- `/kill @e[type=item]` clears items lying on the ground.

!!! warning "Never run /kill @e without a filter" "`@e` includes every player, pet, villager and armor stand in loaded chunks."

### XP command

```text
/xp add <player> <amount> [levels|points]
/xp set <player> <amount> [levels|points]
```

- `/xp add Luca 30 levels` gives Luca 30 levels.
- `/xp set Luca 0 levels` sets Luca back to level 0.
- `/xp query Luca levels` shows Luca's level.

End with `levels` for levels or `points` for experience points. `/experience` is the same command.

### Effect command

```text
/effect give <player> <effect> [<seconds>]
/effect clear [<player>] [<effect>]
```

- `/effect give Luca night_vision infinite` gives Luca night vision until it is cleared. Write `infinite` instead of the seconds for an effect that never runs out.
- `/effect give @a speed 60 1` gives 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 Luca` removes all of Luca's effects.

### Clear and enchant

- `/clear Luca` empties Luca's inventory. `/clear Luca dirt` removes only dirt.
- `/enchant Luca sharpness 5` enchants the item in Luca's hand. The level can't go above the enchantment's normal maximum.

### Kick, ban and pardon

```text
/kick <player> [<reason>]
/ban <player> [<reason>]
/pardon <player>
```

- `/kick Luca Spamming chat` kicks Luca with that message. Luca can join again.
- `/ban Luca Griefing` bans Luca.
- `/pardon Luca` lifts the ban.
- `/ban-ip Luca` bans the IP address Luca plays from, and `/pardon-ip` lifts it.
- `/banlist` shows every ban.

### OP and whitelist

- `/op Luca` and `/deop Luca` give and take operator status. The [OP guide](https://fps.ms/docs/minecraft/how-to-give-yourself-op) covers it step by step.
- `/whitelist on`, `/whitelist add Luca`, `/whitelist remove Luca`, `/whitelist list` and `/whitelist off` manage who can join. See [how to whitelist players](https://fps.ms/docs/minecraft/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)

```text
/time set <day|noon|night|midnight>
/time set <ticks>
/time add <ticks>
```

- `/time set day` makes it morning.
- `/time set night` makes it night.
- `/time set 6000` is 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)

```text
/weather <clear|rain|thunder> [<duration>]
```

- `/weather clear` stops rain and thunder.
- `/weather rain` starts rain.
- `/weather thunder` starts 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

```text
/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](https://fps.ms/docs/minecraft/finding-and-changing-your-world-seed).

### Spawn point and world spawn

```text
/setworldspawn [<x> <y> <z>]
/spawnpoint [<player>] [<x> <y> <z>]
```

- `/setworldspawn` moves the world spawn to where you stand. New players start there.
- `/setworldspawn 0 64 0` moves it to those coordinates.
- `/spawnpoint Luca 100 64 -200` makes Luca respawn at those coordinates, like a bed would.

### Locate command

```text
/locate structure <structure>
/locate biome <biome>
```

- `/locate structure #village` finds the nearest village of any type.
- `/locate structure ancient_city` finds the nearest ancient city.
- `/locate biome cherry_grove` finds the nearest cherry grove.

Click the coordinates in chat to get a ready-made `/tp` command.

### World border

```text
/worldborder set <size>
/worldborder center <x> <z>
```

- `/worldborder center 0 0` centers the border on x 0, z 0.
- `/worldborder set 2000` makes the playable area 2000 by 2000 blocks.
- `/worldborder get` shows 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.

```text
/tellraw @a {"text":"Welcome!","color":"gold"}
```

## Building commands

All of these need level 2.

### Fill command

```text
/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 stone` turns the floor around you into an 11 by 11 stone square.
- `/fill ~-3 ~ ~-4 ~3 ~4 ~4 stone hollow` builds a hollow stone box around you.
- `/fill 0 60 0 20 70 20 air` clears everything between those two corners.
- `/fill 0 60 0 20 70 20 gold_block replace dirt` replaces only the dirt.

One fill can change up to 32,768 blocks. For bigger areas, split it into several fills.

### Clone command

```text
/clone <from> <to> <destination> [masked]
```

- `/clone 0 64 0 10 70 10 100 64 100` copies the box between the first two corners and puts the copy's lowest corner at 100 64 100.
- Add `masked` at the end to copy only the blocks and skip the air.

### Setblock command

```text
/setblock <x> <y> <z> <block>
```

- `/setblock ~ ~ ~1 chest` places a chest next to you.
- `/setblock 0 64 0 diamond_block` places a diamond block at those coordinates.

### Summon command

```text
/summon <entity> [<x> <y> <z>]
```

- `/summon zombie` spawns a zombie where you stand.
- `/summon creeper ~ ~ ~5` spawns a creeper 5 blocks away.
- `/summon lightning_bolt ~ ~ ~5` strikes lightning 5 blocks away.

Want a server to try these on? [Make a free Minecraft server on FPS.ms](https://fps.ms/free-minecraft-server-hosting).

---

[FPS.ms](https://fps.ms/index.html.md) · [All pages](https://fps.ms/llms.txt) · [Documentation](https://fps.ms/docs/llms.txt)
