Skip to content
Minecraft

Useful Minecraft commands with examples

Published on 3 October 2026

You run a Minecraft command by typing it in chat with a slash in front, like /time set day to make it daytime straight away. In your own world, commands have to be allowed, and on a server you need to be an operator; in the server console you type the same thing without the slash.

Below are the commands people actually use, with examples for Java and Bedrock. Checked against Java 26.3 and Bedrock 26.52.

How do you use commands in Minecraft?

  • Open chat: on PC press T, or / to start with the slash already typed. Tab completes names and commands.
  • Java: switch on Allow Commands when you create a world. Forgot? Since 26.2 you can switch it on later through Esc and World Options.
  • Bedrock: switch on Activate Cheats in your world settings. Achievements are then off for good in that world.
  • Server: you need operator rights. The server console can run everything, without the slash.

Instead of a player name you can use a target selector: @s is you, @p the nearest player, @a all players and @e every entity, mobs and dropped items included.

Which commands change time, weather and game mode?

Commands for time, weather, game mode and teleporting. A single command works in both Java and Bedrock.
What you wantCommand
Make it day/time set day
Stop timeJava: /gamerule advance_time false
Bedrock: /gamerule dodaylightcycle false
Clear weather/weather clear
Creative mode/gamemode creative
No monsters/difficulty peaceful
Go to coordinates/tp @s 100 64 -200
Go to a friend/tp Alex
Find a villageJava: /locate structure #village
Bedrock: /locate structure village
Skip the night with one sleeperJava: /gamerule players_sleeping_percentage 0
Bedrock: /gamerule playerssleepingpercentage 0

/time set also takes night, noon or midnight. The game modes are survival, creative, adventure and spectator; add a player name to switch someone else. In Java you see your coordinates with F3. In Bedrock, switch on Show Coordinates in your world settings.

Which commands give items, effects and XP?

  • /give @s minecraft:cake gives you a cake. In Bedrock it’s /give @s cake. Rather bake one? See how to make a cake in Minecraft.
  • /effect give @s minecraft:night_vision infinite gives you night vision that never ends. In Bedrock: /effect @s night_vision infinite. /effect clear @s (Bedrock: /effect @s clear) removes all effects.
  • /enchant @s minecraft:sharpness 5 enchants whatever you’re holding, if it fits. The full list is in the best Minecraft enchantments.
  • /xp add @s 30 levels gives you thirty levels. In Bedrock: /xp 30L @s.
  • /kill @e[type=minecraft:item] clears dropped items lying around (Bedrock: /kill @e[type=item]). Handy when the server starts to lag.

Which commands manage players on a server?

Server admin commands (leave out the slash in the console)
CommandWhat it does
op AlexMakes Alex an operator. deop Alex takes it away again.
whitelist add AlexAdds Alex to the whitelist. In Bedrock it’s allowlist add Alex.
whitelist onOnly players on the list can join. New Java servers have it on by default since 26.3.
kick AlexRemoves Alex from the server. He can rejoin right away.
ban AlexBans Alex. pardon Alex lets him back in (Java).
listShows who is online.
say Cake at spawn at eight!Sends a message to everyone.
save-allSaves the world right now (Java). Useful before a backup.

Step by step: use your server console and turn on the whitelist and add operators. Kids on your server? Then the whitelist is the most important command of all; also read a Minecraft server for your kids. And if nobody should lose their stuff, turn on keep inventory.

Which commands help with building?

  • /fill 0 64 0 10 70 10 minecraft:stone fills the space between two points with stone. In Java that’s up to 32,768 blocks at a time.
  • /clone copies part of the world to another spot, and /setblock places a single block.
  • /setworldspawn turns the spot you’re standing on into the world spawn. More in how to set the spawn on your Minecraft server.
  • Building big? WorldEdit is faster than single commands. Read how to use WorldEdit.

Want to be in charge of the commands? On your own Minecraft server you’re the operator and you set the rules, even when your friends play without you. See the Minecraft plans.

Frequently asked questions

How do you turn on commands in Minecraft?

In Java, switch on Allow Commands when you create a world, or later through Esc and World Options. In Bedrock, switch on Activate Cheats, which turns off achievements in that world. On a server you need to be an operator.

What is the command to make it day in Minecraft?

/time set day. Add /gamerule advance_time false (Java) or /gamerule dodaylightcycle false (Bedrock) to keep it day.

How do you make someone an operator on your server?

Type op followed by the player name in the server console, without a slash. deop removes the rights again.

How do you teleport to a friend in Minecraft?

Type /tp followed by your friend’s name. /tp @s 100 64 -200 takes you to coordinates instead.

Do Java commands work in Bedrock?

Most do, but some differ. Bedrock writes game rules as one word, /effect and /xp work a little differently and Bedrock has no ban command.

More questions? See all frequently asked questions

Related articles