Commands

Commands may be used by players, operators and the Command Block while in multiplayer connected to a Minecraft server, and in singleplayer when the user has cheats enabled for the world (cheats are enabled during world creation via the "More World Options..." button). Some commands are also available in singleplayer even when cheats are not enabled. Commands may be entered from a Minecraft client while in the game or on the host computer's server console.

Commands being entered into the Minecraft client itself must be prefixed by a slash (example: ). The command window is identical to the chat window and can be accessed by pressing or starting directly by entering a slash.

Commands being executed via the console are not preceded by a slash. Commands in command blocks can be preceded by a slash, but this is not required.

Pressing cycles through possible commands or arguments.

In the following tables, required arguments appear in, and optional arguments appear in [square brackets]. Arguments in italics should be replaced by an appropriate value; arguments in plain text must be entered exactly as shown.

Player commands
These commands can be used in the chat window by any player who is allowed to connect to a server, and can also be used in singleplayer whether or not cheats are enabled.

would create a saddled pig named Mr. Pig at the player's current location. | x and z must fall within the range -30,000,000 to 30,000,000 (exclusive), and y must be at least 0. If coordinates aren't specified the entity will spawn at the player's location (or inside a command block if the command was executed by one). |- | tellraw   | Sends a message to a specified player, or to every player online on a server. Links can also be sent, with customizable actions when they are clicked, for example giving an apple to a player or teleporting the player to another location. This command can also be used to fake player messages. raw message uses JSON. Here is a useful tool to help create messages with JSON. Note that in the game, color will default to white if not given and all formatting (bold, italic, etc.) will default to false if not given, so you don't have to use the exact command the tool gives you. | playername must be online, and the message text must be correctly coded in JSON. |- | testforblock     [datavalue] [dataTag] | Used to test whether a particular block is in the x, y and z coordinates specified. Datatags will not work unless a special syntax is used to specify what type of number (s for short, b for byte, L for long, f for float and d for double). Also all relevant tags must be included even if they are unused (e.g.: Chest contents must include slot (b) id (s) Damage (s) and count (b)) | tilename must exist, datavalue must exist if specified, and dataTag must evaluate if specified. |- | time set ||Sets the world time. number is an integer between 0 and 24000, inclusive, where 0 is dawn, 6000 midday, 12000 dusk and 18000 midnight. Number can be greater than 24000; in this case, the time of day wraps around, but the moon's phase is advanced. However, Setting the time "backward" (earlier than the current time) does not change the moon. "time set day" sets the time to 1000, and "time set night" sets the time to 13000. | Number must be 0 or positive, or "day" or "night". |- | time add  | Increments the world time, as above. | Number must be 0 or positive. The daytime wraps, and the moon's phase advances; adding 24000 will advance the moon's phase by one day. |- | toggledownfall | Toggles rain and snow. |Always succeeds. |- | tp [playername]  | Teleports player playername to targetplayer 's location. If no player is specified, it will teleport yourself. | Playername is not optional in command blocks. Both players must be online. |- | tp [playername]    | Teleports player playername (or yourself if no player is specified) to coordinates x,y,z. (the y value cannot be smaller than 0). Can also relatively move the player by adding the ~ character before the coordinate value. For example typing /tp John ~3 64 ~3 will teleport a player called John 3 blocks away from his current x and z, and to y 64. | x and z must fall within the range -30,000,000 to 30,000,000 (exclusive), and y must be at least 0. Playername is not optional in command blocks, and the player must be online. |- | weather (clear | rain | thunder) [seconds] | Changes the weather for the specified duration. | Seconds must be at least 1, and cannot be greater than 1,000,000, and a valid weather condition must be provided. |- | xp  [playername] | Gives the specified user the given number of orbs. Maximum is 2,147,483,647 per command. Negative amounts may not be used to remove experience points. || Amount can be at most 2,147,483,647. Playername is not optional in command blocks, and player must be online. |- | xp L [playername] | Gives playername the amount number of experience levels. Maximum is 2,147,483,647 — if a player is given levels pushing them past this limit, they get reset to 0. Negative amounts may be used to remove experience levels. | Amount must be between -2,147,483,648 and 2,147,483,647, inclusive. Playername is not optional in command blocks, and player must be online. |}

Multiplayer-only Commands
These commands are usable by ops (operators) from the server console as well as through the chat window when prefixed by the command character (a forward slash). These commands are only available in multiplayer mode. With the exception of the list command, none of these commands can be executed by a command block, and none make use of target selectors. Many of these commands can be used on players who have never been to the server, or even on names which are not (or cannot be) registered as Minecraft accounts.

Command-Block-only commands
These commands can be used only in a Command Block and cannot be used in other ways. Command blocks are only obtainable via the  command. Using  is currently being deprecated by Mojang

Data tags
NBT tags can be specified for items and entities created with the, and other commands. Data tags are data structures. The format is JSON, although it is not strict (lenient). The data is represented as a comma separated list of pairs. Each pair has the format. The key is the name of the NBT tag and the value is the data that should be assigned to it. Tag names are case-sensitive, and whitespace outside keys or values is ignored.

The value can be different types:


 * String is a piece of text, can be wrapped with double-quotes. Double quotes have to be used if the String contains commas, curly braces or square brackets. To use double-quotes inside Strings, the quote is escaped by a backslash . When using the summon command, escaping is disabled (except for double quotes) and keys must not be quoted (probably a bug ). This causes an issue where trailing backslashes do not work (as do any other things that need to be escaped), even when escaped properly. The reason is that it escapes the quotation mark after the string which causes a malformed JSON object.
 * Number are 1 or more digits that can have a leading sign ( / ). They're classified in Integers, that don't have a decimal mark, Doubles, that uses a dot as a decimal mark, and Floats, that also have   appended after the number. Examples:  ;  ; &
 * Array (or 'List') is multiple, comma separated values wrapped with square brackets. The containing values do not need to be of the same type.
 * Boolean can either be  or , but using Numbers works, too. When using numbers, everything between 0 and below 1 is false, other is true.
 * Hash or 'Object' is a container for data structures (as explained above). They are wrapped with curly braces. Notice: The Data tag itself is a Hash. Example:
 * null This is a placeholder an empty value. Do not put quotes.

For a complete listing of defined tags (though not all can be modified by commands), see:
 * Blocks
 * Entities
 * Mobs
 * Projectiles (arrows, fireballs, thrown potions, etc.)
 * Items (items on the ground)
 * Vehicles (boats, minecarts, etc.)
 * Dynamic Tiles (primed TNT, falling sand/gravel)
 * Other Entities (firework rockets, paintings, and item frames)
 * Tile Entities (chests, furnaces, command blocks, mob spawners, signs, etc.)
 * Player
 * Items (items in player's inventory or containers)

For a complete list of identifiers, see:
 * blocks
 * items
 * entities
 * enchantments
 * status/potion effects
 * attributes