In the client, commands are entered via the chat window, which is displayed by pressing the T key (default) or / key. Using the / key will also enter the forward slash that commands require as a prefix, so it is a useful shortcut. The ↑ and ↓ key can be used to view previously entered text, including all previously executed commands. Pressing Tab ↹ while entering commands cycles through possible commands or arguments, and can be used to auto-enter the coordinates of the block looked at before entering chat.

Commands may also be entered in a multiplayer server's console, but are not preceded by a / when entered this way. A server admin running commands in this way is often referred to as "ghosting".

Commands in command blockscan be preceded by a slash, but it is not required. Commands in a command block usually also require an optional argument, like a player's username.

The majority of commands are only available in the following situations:

In other multiplayer games, entered by the player who opened a LAN game with cheats enabled, or is hosting their own multiplayer server

In singleplayer, if cheats were enabled at world creation (via the "More World Options..." button).

Some player commands are also available in singleplayer even when cheats are not enabled.

Note: In singleplayer worlds where cheats were not enabled at creation, they can be enabled on a temporary basis by opening the current game session to LAN play ( Esc → "Open to LAN", then "Allow Cheats" button and "Start LAN World"). You do not actually need to be on a LAN or have others join. This is not permanent, but will allow the use of commands until you quit the world, and changes you make via commands (items spawned, etc.) will be saved with the world. You can do this each time you start playing the world again. Note that this will disable game pausing for the duration, so while open to LAN, you should get somewhere safe or reload your world before using the Game Menu. Remember that you can disable your LAN world by reloading the world.

Many commands allow relative coordinates to be specified using tildes (~). A number following a tilde or caret is an offset from something rather than a coordinate. The sign of the offset specifies whether to go in the positive or negative direction for that axis. A single tilde by itself is shorthand for ~0.

For example, /tp 0 64 0 will teleport the user to the coordinate (0, 64, 0), while /tp ~3 ~ ~-3 will teleport the user to a position +3 blocks in the "x" direction (i.e., east), keep their current height, and -3 blocks in the "z" direction (i.e., north) and /tp ^ ^ ^3 will teleport the user to a position +3 forwards.

Usually absolute coordinates can be mixed with relative coordinates. For example, /tp ~ 64 ~ will keep the user's "x" and "z" coordinates the same, but teleport them to absolute height of 64, however /tp ^-5 ^ ^ will teleport the player to the right according to the tilt of their head. Carets are used /tp ^left ^up ^forward.

The origin for the offset depends on the command. For example, in /tp the offset is from the target's starting position. Other common offsets include from the position of the command's execution or from another coordinate specified by the command.

This section needs updating. Description: Does not account for differences between Java 1.13 and Bedrock

In most commands where a player may be specified as an argument, it is possible to "target" one or more players satisfying certain conditions instead of specifying players by name. To target players by condition, choose a target selector variable and, optionally, one or more target selector arguments to modify the conditions to be satisfied.

For example, to change the game mode of all players on team Red to creative mode, instead of specifying them by name individually:

A target selector variable identifies the broad category of targets to select. There are five variables:

@p

Targets the nearest player. When run by the console, the origin of selection will be at (0, 0, 0). If there are multiple nearest players, caused by them being precisely the same distance away, the player who most recently joined the server is selected.

Target selector arguments may be used to reduce the set of players from which the nearest player will be selected. For example, @p[team=Red] will target the nearest player on team Red even if there are other players closer.

The limit target selector argument can be used to increase the number of nearest players targeted (for example, @p[limit=3] will target the three nearest players).

@r

Targets a random player.

Target selector arguments may be used to reduce the set of players from which a random player will be targeted. For example, @r[team=Red] will only target a random player from team Red.

The limit target selector argument can be used to increase the number of random players targeted. For example, @r[limit=3] will target three random players.

The type argument is not allowed on @r. To select a random entity, use @e[sort=random,limit=1] instead.

@a

Targets all players, including dead players. No other selector will find dead players, except @s.

Target selector arguments may be used to reduce the set of players targeted. For example, @a[team=Red] will only target players on team Red.

@e

Targets all entities (including players).

Target selector arguments may be used to reduce the set of entities targeted. For example, @e[type=cow] will only target cows.

@s

Targets only one entity—the entity that executed the command, including dead players. If the executor was not an entity, for instance if the executor was a command block or a server console, this selector will find nothing.

Target selector arguments may be used to specify whether the executor is actually eligible to be targeted. For example, @s[type=cow,team=Red] will only target the executor of the command if the executor was a cow on team Red.

After a target selector, optional arguments can be used to modify the set of targets selected. When used with @a or @e, arguments narrow down the number of targets from the full list to a specific few. When used with @p or @r, arguments narrow the number of targets down from the full list to a smaller set from which the nearest or random player is selected. When used with @s, the command user will only be targeted if all arguments pass, otherwise the command will fail.

Add argument-value pairs as a comma-separated list contained within square brackets after the target selector variable:

@<variable>[<argument>=<value>,<argument>=<value>,…].

Arguments and values are case-sensitive. Spaces are allowed around the brackets, equal signs, and commas, except in between the target variable and the first bracket. Commas must be used to separate argument-value pairs.

Selecting targets by coordinate

[x=X,y=Y,z=Z] — Selects targets based on distance to that exact position. Combine with selecting by distance to select only targets within a certain distance of that specific position, or combine with volume dimensions to select only targets within a certain cubic volume. If it's combined with neither distance nor volume dimensions, the whole world will be selected.

The coordinates are doubles an allow values like 12.34, and are not center-corrected, meaning x=0 is no longer corrected to x=0.5 - tilde notation is available for selector argument coordinates‌[Bedrock Edition only].

Selecting targets by distance

[distance=DISTANCE] — Selects only targets exactly DISTANCE blocks from the command's execution. If DISTANCE is a range, selects only targets whose distance falls within that range. Only non-negative values are allowed.

If a coordinate (above) and either or both radius/i are both defined, the radius/i will center on the coordinate rather than the postion of the command's execution.

Ranges are supported to allow for only certain distances.

@e[distance=10] — targets only entities exactly 10 blocks away

@e[distance=10..12] — targets only entities more than 10 blocks but less than 12 blocks away (inclusive)

Selects only targets within the volume defined as starting from the location where the command was executed and extending DX blocks in the "x" direction (i.e., east/west), DY blocks in the "y" direction (i.e., upwards/downwards), and DZ blocks in the "z" direction (i.e., north/south). If an initial coordinate is specified with the x, y, and z arguments, that will be used instead of the position of the command's execution for the lower northwestern corner (dx, dy, and dz still specify distances from that coordinate; they do not specify a separate coordinate). All values are allowed, including negative and partial values.

It is possible to combine selection by distance and selection by volume, in which case the command will only select targets within the overlap of both regions (within certain radius/i of the volume's lower northwest corner and not outside the defined volume).

Selecting targets by scores

[scores={OBJECTIVE1=SCORE1,OBJECTIVE2=SCORE2,...}] — Selects only targets with a score in objective OBJECTIVE1 of SCORE1, and a score in objective OBJECTIVE2 of SCORE2.

All tested objectives are in a single tag, with a list of individual score selectors between braces afterwards. The selectors inside the braces support ranges.

@e[scores={myscore=10}] — Selects only entities with a score in objective myscore of exactly 10.

@e[scores={myscore=10..12}] — Selects only entities with a score in objective myscore of between 10 and 12.

@e[scores={myscore=5..}] — Selects only entities with a score in objective myscore of 5 or greater.

@e[scores={myscore=..15}] — Selects only entities with a score in objective myscore of 15 or less.

@e[scores={foo=10,bar=1..5}] — Selects only entities with a score in objective foo of exactly 10, and a score in objective bar of between 1 and 5.

[limit=LIMIT] — Selects only the specified number of targets at maximum.

When used with @p or @r, this argument defaults to 1, so using a higher limit will increase the number of nearest or random targets returned. When used with @a or @e, this argument returns only a limited number of targets.

Using an additional argument sort, one can specify how the targets are chosen and limited.

TYPE must be an entity ID or tags used to identify different types of entities internally (for example, creeper for creepers, minecart for regular minecarts, tnt for primed TNT, etc. Namespaces is acceptable, it can be left out if the namespace is default minecraft:). Entity IDs or tags are case-sensitive and invalid entity IDs will cause the command to fail. One may use type=player or type=!player to selected entities which are or are not players, respectively.

When used with @r, can change its normal behavior of targeting only players to target other entities.

Since 1.13, target selector uses advancements in place of /advancement test. The argument name is the advancement id (namespace can be left out when namespaced minecraft:). The value is true, false or so.

@a[advancements={story/form_obsidian=true}] — Selects players who have achieved the advancement minecraft:story/from_obsidian.

@a[advancements={story/obtain_armor={iron_helmet=true}}] — Selects players who had armored with iron helmet. The selected players needn't be wearing iron helmet when selected, and needn't have achieved the advancement minecraft:story/obtain_armor.

@a[advancements={story/follow_ender_eye=true}] is the same as @a[advancements={story/follow_ender_eye={in_stronghold=true}}].

A data tag is a sequence of text which describes a data structure using attribute-value pairs. Data tags are used in Java Edition commands to specify complex data for players, entities, and some blocks.

A data tag consists of zero or more attribute-value pairs separated by commas and delineated by curly brackets. Each attribute-value pair consists of an attribute name and the attribute's value, separated by a colon. Some values, however, may themselves contain attribute-value pairs, allowing a data tag to describe a hierarchical data structure.

The data structures that data tags describe are the same ones used in Minecraft's save files. These data structures are described in other articles and commands expect data tags to use the same attribute names (which are case-sensitive):

Double quotes must be used if the String contains commas, curly brackets, or square brackets. To include a double quote inside a String, add a backslash before the double quote.

Example:"Call me \"Ishmael\""

List

A sequence of values, separated by commas and delineated with square brackets. The values must be of the same type, which is dictated by the first value in the sequence.

Example:[3.2,64.5,129.5]

Byte Array

A sequence of integers between -128 and 127 (inclusive), separated by commas, delineated with square brackets, and prefixed with B;.

Example:[B;1b,2b,3b]

Int Array

A sequence of integers between -2,147,483,648 and 2,147,483,647 (inclusive), separated by commas, delineated with square brackets, and prefixed with I;.

Example:[I;1,2,3]

Long Array

A sequence of integers between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807 (inclusive), separated by commas, delineated with square brackets, and prefixed with L;.

Example:[L;1l,2l,3l]

Compound

A sequence of attribute-value pairs, separated by commas and delineated with curly brackets.

Example:{X:3,Y:64,Z:129}

Every data tag argument is itself a Compound.

Boolean

A value, expressed as "true" or "false". This is only seen in JSON formatting, as a Byte tag is usually used in NBT data to determine a boolean value as 0 (for false) and 1 (for true).

Example:{doFoo:true}

Some commands may require that a number's type be specified by adding a letter (B, S, L, F, D) to the end of the value. For example, 3s for a short, 3.2f for a float, etc. (This doesn't work with I for int.) The letter can be uppercase or lowercase. When no letter is used and Minecraft can't tell the type from context, it assumes double (if there's a decimal point), int (if there's no decimal point and the number is small enough to store as an int), or string (if neither is true). A square-bracketed literal is assumed to be a list unless an identifier is used: [I;1,2,3] for an int array and [L;1L,2L,3L] for a long array.

When commands such as /testfor, /testforblock, and /clear are used to match data tags, they only check for the presence of the provided tags in the target entity/block/item. This means that the entity/block/item may have additional tags and will still match. This is true even for lists and arrays: the order of a list is not acknowledged, and as long as every requested element is in the list, it will match even if there are additional elements.

Scores and target selectors are evaluated for a Sign when it is placed or edited and for a Written Book when it is "resolved" (opened for the first time after signing). They won't update after that, and they won't work if edited onto an existing sign with an NBT editor, or onto a book that's already marked resolved. There's no way to wrap text onto the next line of a sign or the next page of a book during resolution; instead, the extra text will simply disappear.

The format of raw JSON text is a JSON Object which supports the following (mostly optional) elements:

The base chat component Object

text: A string representing raw text to display directly in chat. Note that selectors such as "@a" and "@p" are not translated into player names; use selector instead. "\n" is newline (enter).

translate: The translation identifier of text to be displayed using the player's selected language. This identifier is the same as the identifiers found in lang files from assets or resource packs. The translated text will only be displayed if the text string is not used.

with: A list of chat component arguments and/or string arguments to be used by translate.

The arguments are text corresponding to the arguments used by the translation string in the current language, in order (for example, the first list element corresponds to "%1$s" in a translation string).

score: A player's score in an objective. Displays nothing if the player is not tracked in the given objective. Ignored completely if text or translate is present.

name: The name of the player whose score should be displayed. Selectors (such as @p) can be used, in addition to "fake" player names created by the scoreboard system. In addition, if the name is "*", it will show the reader's own score (for example, /tellraw @a {"score":{"name":"*","objective":"obj"}} will show every online player their own score in the "obj" objective).

objective: The internal name of the objective to display the player's score in.

value: Optional. If present, this value is used regardless of what the score would have been.

selector: A string containing a selector (@p,@a,@r,@e or @s) and, optionally, selector arguments. Unlike text, the selector will be translated into the correct player/entity names. If more than one player/entity is detected by the selector, it will be displayed in a form such as 'Name1 and Name2' or 'Name1, Name2, Name3, and Name4'. Ignored completely if text, translate, or score is present. Clicking a player's name inserted into a /tellraw command this way will suggest a command to whisper to that player. Shift-clicking a player's name will insert that name into chat. Shift-clicking a non-player entity's name will insert its UUID into chat.

keybind: A string that can be used to display the key needed to preform a certain action. An example is key.inventory which will always display "E" unless the player has set a different key for opening their inventory.

extra: A list of additional objects, sharing the same format as the base object.

A list element with the same format as the base object (recursive). Note that all properties of this object are inherited by children except for text, extra, translate, with, and score. This means that children will retain the same formatting and events as this object unless they explicitly override them.

color: The color to render this text in. Valid values are "black", "dark_blue", "dark_green", "dark_aqua", "dark_red", "dark_purple", "gold", "gray", "dark_gray", "blue", "green", "aqua", "red", "light_purple", "yellow", "white", and "reset" (cancels out the effects of colors used by parent objects). Technically, "bold", "italic", "underlined", "strikethrough", and "obfuscated" are also accepted, but it may be better practice to use the tags below for such formats.

insertion: When the text is shift-clicked by a player, this string will be inserted in their chat input. It will not overwrite any existing text the player was writing.

clickEvent: Allows for events to occur when the player clicks on text.

action: The action to perform when clicked. Valid values are "open_url" (opens value as a URL in the player's default web browser), "open_file" (opens the value file on the user's computer), "run_command" (has value entered in chat as though the player typed it themselves. This can be used to run commands, but the command will fail if the player does not have the required permissions to use it), "change_page" (can only be used in written books) changes to page value if that page exists, and "suggest_command" (similar to "run_command" but it cannot be used in a written book, the text only appears in the player's chat input and it is not automatically entered. Unlike insertion, this will replace the existing contents of the chat input). "open_file" is used in messages automatically generated by the game (e.g. on taking a screenshot) and cannot be used in commands or signs.

value: The URL, file, chat, command or book page used by the specified action. Note that commands must be prefixed with the usual "/" slash.

hoverEvent: Allows for a tooltip to be displayed when the player hovers their mouse over text.

action: The type of tooltip to show. Valid values are "show_text" (shows raw JSON text), "show_item" (shows the tooltip of an item which can have NBT tags), and "show_entity" (shows an entity's name, possibly its type, and its UUID).

value: The formatting of this tag varies depending on the action. Note that "show_text" is the only action to support an Object as the value; all other action values are Strings and should thus be wrapped in quotes.

"show_text": Can be either a raw String of text, or an Object with the same formatting as this base object. Note that clickEvent and hoverEvent do not function within the tooltip, but the formatting and extra tags still work.

"show_item": A string formatted like item NBT data. Contains the "id" tag, and optionally the "Damage" tag and "tag" tag (which is the same compound used as "dataTag" in the /give command).

"show_entity": A string formatted like a compound with the string values "type" (such as "Zombie"), "name", and "id" (should be an entity UUID, but can actually be any string).

Due to the extra tag, the above format may be recursively nested to produce very complex and functional text strings. However, a raw json text doesn't have to be complicated at all: virtually all properties are optional and may be left out.

To be valid, each object must have at least either text, translate, score, selector or keybind (everything else is optional). As a matter of shorthand, however, the entire Object may be substituted with a String. In this case, that string will be considered the value of the text property. For example, "This is raw text" is equivalent to {"text":"This is raw text"}. This shorthand substitution is valid anywhere a raw text object is required (including the base <raw json message> argument of /tellraw, the elements of the extra list, and the value of a "show_text" hover_event).

/tellraw also accepts an array of objects and/or strings; they are concatenated. It even accepts a tree of nested arrays; they are traversed depth-first. For example:

Many commands have arguments that identify particular types of blocks, items, entities, advancements, bossbars, effects, enchantments and so on. In the command syntax below, these typically appear as elements named <block>, <item>, or the like which are replaced with identifiers such as minecraft:stone in the examples. These IDs all have namespaces, and all original Minecraft contents are namespaced "minecraft:", mod contents are namespaced other namespaces. Namespace prefix of IDs namespaced minecraft: can be omitted.

The table below summarizes all commands, including removed and upcoming. Click a column heading to sort by that column. Click the link in the first unit of each row to get detailed usage of each command.

The argument consists of multiple words which could be separated by spaces.

Success Conditions

A command's Success Conditions must be met in order for the game to consider the command "successful". This is used to determine a variety of things, such as the output of a redstone comparator feeding from command block with a command. Note that not all "successful" commands actually do something, and not all "failed" commands fail to do something useful.

Restrictions

Describes restrictions on who can use the command or in what context.

None: The command can be used by any player in any world. The following commands have no restrictions: /help, /me, /tell, and /trigger.

Operator: The command may only be used by an operator or in singleplayer mode with cheats enabled. On multiplayer servers, the results of these commands are broadcast to other ops online.

Added /teleport, which is like /tp, except that the target parameter is mandatory, the 'teleport to other player' usage is unavailable, and the use of relative coordinates is relative to the executor of the command, rather than relative to the target.

A new library named Brigadier is now used to parse commands. Different components of commands are displayed in different colors, and errors will be displayed in red without having to run the command. Commands, for the most part, do not allow uppercase letters, and are now much faster and more efficient.

Functionality of most commands is equivalent to Java Edition 1.10 usage. Differences include: no support for datatags, /clone cannot use forced cloneMode, /gamemode can only use Creative and Survival modes, the player target is optional in /give, and the entity target is optional in /execute.

In other languages

Content is available under CC BY-NC-SA 3.0 unless otherwise noted.Minecraft content and materials are trademarks and copyrights of Mojang and its licensors. All rights reserved.
This site is a part of Wikia, Inc. and is not affiliated with Mojang.