This is a complete, verified reference to Minecraft commands as they work in Java Edition 26.2 (“Chaos Cubed”, released June 16, 2026, under the new YY.D.H year-based version numbering). It covers every core command’s syntax, its required operator (OP) level, the full game-rule list with types and defaults, and the target selectors that let one command affect many players or entities at once. Where the equivalent Bedrock Edition behaves differently, that difference is called out explicitly.
To run any of these, open the chat window (press T or / on Java; tap the chat bubble on Bedrock) and type the command starting with a slash. On a multiplayer server you type them in the server console (no slash) or in-game if you are an operator. In single-player, cheats must be enabled (“Allow Cheats” / Open to LAN with cheats). Speed things up with our free Give Command generator, Summon Command builder, Gamerule Browser, Target Selector helper, and Execute Command builder — or spin the whole world up on Minecraft server hosting.
Full Minecraft command reference (Java 26.2)
| Command | Syntax | Description | OP |
|---|---|---|---|
| /give | give | Give items to players (count 1–2147483647, default 1). | 2 |
| /clear | clear [ | Remove items; no args clears the whole inventory. | 2 |
| /gamemode | gamemode | Set survival, creative, adventure, or spectator. | 2 |
| /defaultgamemode | defaultgamemode | Set the mode new players get on first join. | 2 |
| /difficulty | difficulty [peaceful|easy|normal|hard] | Set or (no arg) query world difficulty. | 2 |
| /effect | effect give | Add or clear status effects. | 2 |
| /enchant | enchant | Enchant the held item (respects max level). | 2 |
| /experience (/xp) | experience add|set|query | Add, set, or query experience. | 2 |
| /summon | summon | Spawn an entity (not players/bobbers). | 2 |
| /kill | kill [ | Instantly kill targets; no arg kills the executor. | 2 |
| /teleport (/tp) | teleport | Move entities to coords or another entity. | 2 |
| /spreadplayers | spreadplayers | Randomly scatter targets around a point. | 2 |
| /time | time set|add|query … | Set, advance, or query world time. | 2 |
| /weather | weather (clear|rain|thunder) [ | Set weather for an optional duration (seconds). | 2 |
| /setblock | setblock | Place a single block. | 2 |
| /fill | fill | Fill a box between two corners. | 2 |
| /gamerule | gamerule | Set or query a game rule (see table below). | 2 |
| /locate | locate structure|biome|poi | Find the nearest structure, biome, or POI. | 2 |
| /seed | seed | Display the world’s numeric seed. | 2 |
| /spawnpoint | spawnpoint [ | Set a player’s personal respawn point. | 2 |
| /setworldspawn | setworldspawn [ | Set the world’s global spawn point. | 2 |
| /say | say | Broadcast a prefixed message to everyone. | 2 |
| /tellraw | tellraw | Send rich JSON/SNBT text (colors, clicks). | 2 |
| /execute | execute | Run a command in a modified context. | 2 |
| /op | op | Grant operator status (multiplayer only). | 3 |
| /deop | deop | Revoke operator status. | 3 |
| /kick | kick | Remove players from the server. | 3 |
| /ban | ban | Banlist a player (also ban-ip, banlist, pardon). | 3 |
| /whitelist | whitelist add|remove|on|off|list|reload | Manage the server allowlist. | 3 |
| /publish | publish [ | Open a single-player world to LAN/online. | 4 |
| /unpublish | unpublish | Close a published integrated server (new in 26.2). | 4 |
| /team · /waypoint | team modify | Set team/waypoint color (lowercase names only). | 2 |
Items, players, and entities
Since Java 1.20.5 — and still current in 26.2 — item commands use data components in square brackets instead of the old {NBT} tags. For example: give @p diamond_sword[enchantments={"minecraft:sharpness":10},custom_name='"Zap"'] 1. Use clear @s minecraft:dirt 64 to strip specific items. /enchant respects normal limits, so enchant @p minecraft:unbreaking 3 won’t exceed the cap, whereas /give with components can. See our deep dives on the give command, item IDs, and the enchantments list.
Entities still use SNBT — components are items-only, so don’t mix the two. summon creeper ~ ~ ~ {powered:true,CustomName:'"Powered Creeper"'} spawns a charged creeper at your feet, and kill @e[type=item] clears dropped items without touching mobs or players. Grant experience with xp add Alice 3 levels. Full walkthroughs live in our summon guide and commands overview.
Target selectors
| Selector | Meaning | Example |
|---|---|---|
| @p | Nearest player | give @p diamond |
| @a | All players (alive or dead) | tellraw @a {"text":"Hi"} |
| @r | Random online player | gamemode spectator @r |
| @s | The executing entity | kill @s |
| @e | All alive entities in loaded chunks | kill @e[type=item] |
| @n | Nearest alive entity (Java 1.21+) | tp @s @n[type=cat] |
Selectors take filter arguments in brackets: type, distance (range notation like ..10 or 3..), limit, sort (nearest/furthest/random/arbitrary), x/y/z with dx/dy/dz volumes, scores, nbt, gamemode, team, level, and more. Most are negatable, e.g. type=!zombie. A worked example: @e[type=item,distance=..5,limit=3,sort=nearest]. Our target selectors guide covers every argument.
Game rules
| Gamerule | Type | Default | Effect |
|---|---|---|---|
| keepInventory | Boolean | false | Keep inventory and XP on death. |
| doDaylightCycle | Boolean | true | Day/night cycle and moon phases progress. |
| doWeatherCycle | Boolean | true | Weather changes naturally. |
| doMobSpawning | Boolean | true | Mobs spawn naturally. |
| mobGriefing | Boolean | true | Mobs can alter blocks and pick up items. |
| doFireTick | Boolean | true | Fire spreads and burns out. |
| doImmediateRespawn | Boolean | false | Respawn instantly, no death screen. |
| commandBlockOutput | Boolean | true | Command blocks broadcast output to ops. |
| sendCommandFeedback | Boolean | true | Command feedback shows in chat. |
| randomTickSpeed | Integer | 3 | Random ticks per section per game tick. |
| doInsomnia | Boolean | true | Phantoms spawn if a player hasn’t slept. |
| fallDamage | Boolean | true | Players take fall damage. |
| naturalRegeneration | Boolean | true | Health regenerates from full hunger. |
| showDeathMessages | Boolean | true | Death messages appear in chat. |
| doTileDrops | Boolean | true | Broken blocks drop items. |
| maxCommandChainLength | Integer | 65536 | Max commands per chain/function. |
| commandModificationBlockLimit | Integer | 32768 | Max blocks per /fill, /clone, /fillbiome. |
| spawnRadius | Integer | 10 | Respawn radius around world spawn. |
| playersSleepingPercentage | Integer | 100 | Percent of players who must sleep to skip night. |
| maxCommandForkCount | Integer | 65536 | Max execution contexts (forks) per tick. |
Rule names are case-sensitive camelCase in Java. Set one with gamerule keepInventory true or read it back by omitting the value: gamerule randomTickSpeed. Note that commandModificationBlockLimit (default 32768, added in 1.20.3) replaced the old hardcoded /fill cap, so raising it lets larger fills run: gamerule commandModificationBlockLimit 1000000. More in our gamerules list and keepInventory guide.
The /execute command
/execute runs another command in a modified context using subcommands: modifiers (as, at, positioned, rotated, facing, align, anchored, in, on, summon), conditions (if/unless against block, blocks, data, entity, predicate, score, biome, and more), and store to capture a result. Example: execute as @a at @s if block ~ ~-1 ~ #minecraft:wool run kill @s. In 26.2, execute on owner now counts vexes as owned by their evoker.
How to run these
Chat: press T or /, type the command, hit Enter. Command block: obtain one with give @p command_block, place it, and type the command without the leading slash; the block runs on a redstone pulse or continuously. Server console: type the command with no slash directly in the dedicated-server terminal — the console runs at the highest permission level, so it can execute anything including op, whitelist, and stop.
Java’s OP model gates commands by level: Level 2 covers gameplay/cheat commands (give, tp, summon, gamerule, fill…), Level 3 covers moderation (op, deop, kick, ban, whitelist), and Level 4 covers server administration (publish/unpublish, stop, save). Set the default operator level with op-permission-level in server.properties.
Java vs Bedrock notes
- Item format: Java uses
item_id[components]; Bedrock still uses numeric data values, e.g.give.- [amount] [data]
- Shorthands: Bedrock accepts numeric game modes (
0/1/2) and difficulties (0–3); Java uses names. - Effects: Java supports
infiniteduration; Bedrock has no infinite keyword and one combined form. - Selectors: Bedrock uses
r/rmfor distance,mfor gamemode,cfor limit, and lacks Java’snbt=andteam=filters.@nexists in both (Java 1.21 / Bedrock 1.21.100). - /execute: Bedrock lacks
on,summon,data,dimension,loaded,predicate,items,functionconditions, and allstoresubcommands; it processes depth-first vs Java’s breadth-first. - /tellraw: Bedrock wraps text in a
rawtextobject:tellraw @a {"rawtext":[{"text":"..."}]}. - Versioning: Java 26.2 corresponds to a differently numbered Bedrock build (Java 26.1 ↔ Bedrock 26.10).
FAQ
How do I turn on cheats to use commands?
In single-player, enable “Allow Cheats” (or Open to LAN with cheats on). On a server you must be an operator — add yourself with op from the console — or run commands directly in the server console, which needs no OP.
Why does my /give command say the item is invalid?
Since 1.20.5, Java uses data components in square brackets, not {NBT} tags. Write diamond_sword[enchantments={"minecraft:sharpness":5}], not the old NBT form. Our Give Command tool builds valid 26.2 syntax for you.
What changed for commands in 26.2?
/publish gained a leading online Boolean and auto-unpublishes an existing integrated server; the new /unpublish closes it. /team and /waypoint color arguments now accept only lowercase, underscore-separated names like dark_red. /execute on owner now treats vexes as owned by their evoker.
How do I keep my items when I die?
Run gamerule keepInventory true. It defaults to false and works identically in Java and Bedrock, keeping both your inventory and XP on death.
How do I teleport to specific coordinates?
Use teleport @a 100 64 -200 (or the alias /tp). You can add a rotation or facing a point/entity. Bedrock orders arguments differently and always faces feet. See our teleport commands guide.
What’s the difference between /op levels?
Level 1 bypasses spawn protection, level 2 unlocks gameplay/cheat commands, level 3 adds moderation (kick/ban/whitelist), and level 4 grants full server administration. Set the default with op-permission-level in server.properties.
Ready to play?
Run your own Minecraft server with XGamingServer
Spin up an always-on Minecraft server your friends can join in minutes — no port-forwarding, no tech headaches.







