Minecraft commands can give you god-like control of your game. Whether it’s to copy an existing build, change the gamemode, or flat out cheat your way to glory, Minecraft console commands are an important part of playing the game day-to-day. While there are a lot of different commands out there, all varying in complexity, we’ve got a run down of the ones you need to know, and, of course, the ones you can use to troll your friends. Because what’s Minecraft without a bit of friendly griefing?
If you're wondering how to enter the Minecraft console commands listed below, all you need to do is hit the forward-slash key (/) and that’ll bring up a small window. Input the code and hit enter and your command will activate.
Shorthand Code Commands for Minecraft
Below are the shorthand codes to save you from typing in different player names. These are worth memorising so you don’t have to type in names like “Sniper_Kitty_Bruv_91” every time some jobber joins your game.
- @p – the player nearest to you
- @r – a random player
- @a – all players
- @e – all entities in the world.
- @s - yourself
The clone command
/clone <x1> <y1> <z1> <x2> <y2> <z2> <x> <y> <z>
Clones a selection of blocks to another location. Very helpful if you’re building a city space and want to duplicate multiple buildings to different areas. “<x1> <y1> <z1>” is your start point. “<x2> <y2> <z2>” is the end point. And “<x> <y> <z>” is where you want the cloned blocks to spawn.
Example: /clone 100 234 -10 200 100 0 300 200 100
How to change the difficulty
Changes the in-game difficulty. Replace the latter section of the code with one of the following:
Example: /difficulty peaceful
Add an effect to yourself or someone else
/effect <player> <effect> [seconds] [amplifier] [hideParticles]
Adds a status effect to the targeted player. “[seconds]”, “[amplifier]”, and “[hideParticles]” are all optional conditions, so feel free to ignore them unless you want to change the length, how strong the effect is, or whether the effect shows as particles or not. If you want to remove an effect from a player, type “/effect <player> clear”.
Example: /effect PCGamer water_breathing 30
Enchant an item
/enchant <player> <enchantment ID> [level]
Adds an enchantment to the item the player is holding. So that’s smite, bane of the arthropods, sharpness—any enchantment you’d pull from a book or enchant table. Here's a list of Enchantment IDs.
Example: /enchant PCGamer minecraft:smite 1
/xp <amount> [player]
Gives the targeted player an amount of experience points. If you just want to add levels instead, which is easier for enchanting, try “/xp <amount>L [player]”.
Example: /xp 100L PCGamer
Change the gamemode
Changes the gamemode for everyone in the session. Add a player’s name to the end of the code to alter the mode for different players. Replace "<mode>" with one of the following options:
Example: /gamemode Survival
Give an item or items
/give <player> <item> [amount]
Drops an item into the player’s inventory. Perfect for if you want to start a run with a full set of diamond gear. Just keep in mind the amount section only works for stackable items. You can’t give yourself 100 diamond swords in one go, as cool as that’d be. For a full list of item IDs, head here.
Example: /give PCGamer diamond_sword 1
Help if a command isn’t working
/help [command name]
Offers additional information about any console command. If you’re trying a command and it isn’t working as it should, type the above command before the name of the command that isn’t working and you’ll be treated to more details about how it works.
Example: /help kill
Turn keep inventory on
/gamerule keepInventory true
Changes the game rules so should you die, you keep all the items in your inventory. Replace “true” with “false” to turn it off again.
Kill everyone or everything
Kills everything, including the player. But should you want to kill another player, use “/kill <player>”. And to kill a certain type of mob, “/kill @e[type=mobType]”.
The play sound command
/playsound <sound> <player>
Plays a specific sound file. Great for if you want to use a command block to play a sound when someone opens a door. Who doesn’t love a good doorbell? Take a look at all the sound file names here.
Example: /playsound minecraft:entity.elder_guardian.ambient voice @a
How to check the world seed
Displays the seed for their current world should you wish to replay the seed again from scratch or pass it along to a mate.
Set the world spawn
Changes the world spawn to wherever the player is standing. If you don’t want to do that, you can also set it to a predetermined location with “/setworldspawn <x> <y> <z>”
Example: /setworldspawn 100 80 0
Stop time from changing
/gamerule doDaylightCycle false
This completely turns the daylight cycle off so it’ll always be the current time of day. To reenable the cycle, replace “false” with “true.”
Spawn a mob
/summon <entity_name> [x] [y] [z]
Summons a mob to a specific location. Remove the “[x] [y] [z]” section at the end to have the mob spawn right on top of you. Just remember if you’re spawning the Wither you’ll need to leg it as fast as possible.
Example: /summon creeper
/tp [target player] <x> <y> <z>
Teleports the targeted player to a designated location. And yes, you can indeed teleport a friend into the sky and laugh as their body flails back down to earth.
Example: /tp PCGamer 100 0 10
Alter the in-game time
/time set <value>
Sets the in-game time. Add one of the following numbers onto the end to change the time of day to something else:
- 0 - Dawn
- 1000 – Morning
- 6000 – Midday
- 12000 – Dusk
- 18000 - Nightist
Change the weather to something nicer, or worse
Changes the in-game weather to a different type. I.e. “/weather thunder” would start a thunderstorm. This one’s a must if you’re going after charged creepers. Nobody's got time to sit around waiting for it to thunder.