Last updated: 8 November 2026
The Essential Minecraft Commands for Java & Bedrock
Turn on cheats for your world, press T to open chat, and type a command starting with / — for example /gamemode creative or /time set day. Below are the commands players actually use, with exact syntax for Java and Bedrock and the places where the two editions differ.
01How to Enable and Run Commands
Commands need cheats. In Java the world-creation option is called Allow Commands; Bedrock calls it Allow Cheats. Both can be switched on later from the world options (Java) or the Cheats tab in world settings (Bedrock). In Java, opening a singleplayer world to LAN also gives a temporary cheat allowance.
Open chat with T (or press /, which opens chat with the slash already typed) and enter the command. Tab completion lists valid arguments as you type. Commands typed in a server console do not take the slash.
- Java permission levels: 0 is a normal player, 1 bypasses spawn protection, 2 (Gamemaster) covers most gameplay commands and command blocks, 3 (Admin) adds multiplayer management such as
/op, and 4 (Owner) is everything. In singleplayer with cheats on you are level 4. - Bedrock: there are no Java-style numeric levels for players; you are an operator or you are not, and commands also need cheats enabled for the world.
- Multiplayer: on a Java server use
/op <player>from the console or an existing operator; levels are stored inops.json.
02Target Selectors: @p, @a, @r, @e, @s, @n
Most commands take a target. Selectors let you aim at players or mobs without typing names.
@s— the entity running the command (you).@p— the nearest player.@a— every online player.@r— a random online player.@e— every living entity in loaded chunks (plus players).@n— the nearest living entity (Java).
Add filters in square brackets, separated by commas. Java examples: @e[type=zombie,distance=..20] (zombies within 20 blocks), @a[gamemode=survival], @e[type=cow,limit=1,sort=nearest]. Java filters include distance, type, limit, sort, level, gamemode, name, tag, team and scores. Bedrock uses shorter names: r/rm for maximum/minimum distance, c for count, l/lm for level and m for game mode.
Note: in Java the type filter cannot be combined with @a, @p or @r. To pick a random mob in Java use @e[sort=random,limit=1].
03Player and World Commands
The commands below cover most day-to-day cheating. Java syntax first, Bedrock differences after.
- /gamemode —
/gamemode <survival|creative|adventure|spectator> [target]. Java no longer acceptss/cor numbers; Bedrock still acceptss,c,a,dand numeric IDs. - /tp (/teleport) —
/tp <x y z>moves you;/tp <target> <destination>moves someone to a player, mob or coordinates. Use~for relative coordinates (/tp @s ~ ~10 ~lifts you 10 blocks). Java addsfacingto point the target at a position or entity; Bedrock adds acheckForBlocksoption. X/Z limit is ±30,000,000 blocks. - /time —
/time set day|noon|night|midnightor a tick value,/time add <amount>,/time query. Named times are day = 1000, noon = 6000, night = 13000, midnight = 18000 ticks; a full day is 24000 ticks. Time units acceptd(day),s(second = 20 ticks) andt. Bedrock additionally hassunrise(23000) andsunset(12000). - /weather —
/weather clear|rain|thunder [duration]. Without a duration Java picks a random one; Bedrock durations are in ticks (random 300–900 seconds if omitted). - /difficulty —
/difficulty peaceful|easy|normal|hard; with no argument Java reports the current setting. Bedrock acceptsp/e/n/hor 0–3. - /setworldspawn —
/setworldspawn [x y z]sets the world spawn point;/spawnpointsets a player's own respawn point. - /seed — prints the world seed in Java (level 0 in singleplayer, level 2 on servers).
- /locate — Java:
/locate structure <structure>(tags such as#villagework),/locate biome <biome>,/locate poi <poi>. Bedrock haslocate structureandlocate biome. The result shows coordinates and the distance in blocks; click the coordinates in chat to build a teleport. Pair it with the stronghold guide.
04Items, XP and Effects
- /give — Java:
/give <target> <item> [count], e.g./give @s minecraft:diamond 64. Since 1.20.5 item data uses data components in square brackets instead of NBT curly braces. Bedrock:/give <player> <item> [amount] [data] [components]. - /clear —
/clear [target] [item] [maxCount]empties an inventory or removes a specific item. In Java,maxCount 0only counts matches without removing anything. - /effect — Java:
/effect give <target> <effect> [seconds] [amplifier] [hideParticles]and/effect clear;infinitereplaces the duration for a permanent effect. Bedrock drops the wordgive:/effect <player> <effect> [seconds] [amplifier]. The default is 30 seconds; amplifier runs 0–255. - /xp (/experience) — Java:
/xp add @s 10 levels,/xp set ...,/xp query @s levels. Bedrock:/xp 10 @sfor points or/xp 10L @sfor levels. See the enchanting guide for what to spend levels on. - /kill —
/kill [target]; defaults to yourself. It ignores armor and protection, so/kill @e[type=item]is the classic way to clear dropped items.
05Building Commands: /fill, /setblock and /clone
/setblock places one block: /setblock <x y z> <block> [destroy|keep|replace]. keep only places into air; destroy breaks the old block as if mined. Java also has a strict mode that skips block updates.
/fill fills a box between two corners: /fill <from> <to> <block> [mode]. Modes:
replace— the default; swaps every block in the region. Add a filter to replace only one type:/fill ~ ~ ~ ~10 ~5 ~10 glass replace stone.hollow— builds the outer shell and fills the inside with air.outline— builds the shell and leaves the inside untouched.keep— only fills air.destroy— breaks existing blocks so they drop as items.
A fill that is too large simply fails. Java controls the limit with a gamerule, which was renamed to max_block_modifications in 1.21.11; check it with /gamerule max_block_modifications and raise it if a big build is rejected. Bedrock uses fixed limits.
/clone copies a region: /clone <begin> <end> <destination> [replace|masked|filtered] [normal|move|force]. move leaves air behind, masked skips air in the source. The same block-count limit applies in Java; Bedrock caps clone at 655,360 blocks.
06Gamerules Worth Knowing
/gamerule <rule> [value] changes world behaviour; leave the value off to read it. Rule names are case-sensitive in Java. Current Java versions use snake_case names for many rules, for example:
keep_inventory true— keep items and XP after dying.advance_time false— freeze the day–night cycle.advance_weather false— stop the weather changing.mob_griefing false— stops mobs such as creepers and endermen changing blocks.tnt_explodes,spawn_phantoms,natural_health_regenerationandrandom_tick_speed(default 3) also use this style.
Bedrock names stay camelCase and are case-insensitive — if a name is rejected, type /gamerule and use tab completion to see what your version accepts. Older Java worlds and tutorials (before the 1.21.11 rename) use names like keepInventory and doDaylightCycle.
07Summoning Mobs and Using Command Blocks
/summon: /summon <entity> [x y z] [nbt], e.g. /summon minecraft:cow ~ ~ ~. Players cannot be summoned, and hostile mobs cannot be summoned on Peaceful difficulty in recent Java versions. Bedrock adds optional rotation, spawn event and name tag arguments.
Command blocks run commands automatically. Get one with /give @s minecraft:command_block or from the creative Operator Utilities tab (needs the Operator Items Tab option). Only an operator in Creative mode can place or edit them. On Java, the gamerule command_blocks_work must be true — this replaced the old enable-command-block server.properties setting in 1.21.9. On Bedrock enable Command Blocks in the world options. Several admin commands (ban, op, stop and similar) are blocked inside them. Command blocks are a gateway to automation; for redstone-based builds start with redstone basics.
08Java vs Bedrock: Quick Differences
- Item syntax: Java uses
item[component=value]data components; Bedrock adds[data]and[components]arguments. /effect: Java needsgive, Bedrock does not./xp: Java usesadd/set/query; Bedrock uses a plain number with anLsuffix for levels.- Selector filters: full names in Java (
distance,limit), short ones in Bedrock (r,c). - Short forms such as
/gamemode cwork on Bedrock only. - Removed on Java:
/replaceitem,/setspawn(use/setworldspawn),/chunk(use/forceload),/testfor,/stats,/locatebiome./replaceitemstill exists on Bedrock. - Aliases:
/tp=/teleport,/xp=/experience,/wand/tell=/msg.
Commands such as /fill, /clone and /kill are hard to undo, so back up the world before experimenting.
FAQ
How do I enable commands in Minecraft?
Turn on Allow Commands (Java) or Allow Cheats (Bedrock) when creating the world, or switch it on later in the world options. In a Java singleplayer world you can also open it to LAN with cheats allowed. Then press T and type a command starting with /.
How do I get a command block?
Run /give @s minecraft:command_block, or take one from the creative Operator Utilities tab. You must be an operator in Creative mode, and command blocks must be enabled (Java gamerule command_blocks_work; Bedrock world option).
What is the command to change gamemode?
/gamemode creative, /gamemode survival, /gamemode adventure or /gamemode spectator. Add a player name or selector to change someone else, such as /gamemode creative @a. Only Bedrock accepts shortcuts like c and s.
How do I teleport to coordinates?
Use /tp @s x y z, for example /tp @s 100 70 -250. Relative coordinates with ~ work too: /tp @s ~ ~20 ~ moves you 20 blocks up. /tp
How do I make it day or stop rain?
/time set day makes it morning (tick 1000) and /weather clear stops rain or thunder. To keep it from changing again, set the gamerules advance_time and advance_weather to false in current Java versions.
How do I keep my inventory when I die?
Run /gamerule keep_inventory true in current Java versions. If your version rejects that name, try keepInventory — tab completion in chat shows which spelling your version uses.
Why does /fill say it is too large?
The region exceeds the block-modification limit. In Java it is controlled by a gamerule (max_block_modifications since 1.21.11); raise it, or split the build into several smaller /fill commands.
How do I find a village or structure with a command?
Use /locate structure minecraft:village_plains (or the #village tag in Java) and click the coordinates in chat. /locate biome
Sources
Where the facts on this page were checked. If one of them now says something different, we want to know — tell us and we will fix the guide.
- Commands Minecraft Wiki
- Target selectors Minecraft Wiki
- Permission level Minecraft Wiki
- Command block Minecraft Wiki
- /give Minecraft Wiki
- /fill Minecraft Wiki
- /gamerule Minecraft Wiki
- /teleport Minecraft Wiki
- /time Minecraft Wiki
- /weather Minecraft Wiki
- /setblock Minecraft Wiki
- /gamemode Minecraft Wiki
- /effect Minecraft Wiki
- /experience Minecraft Wiki
- /locate Minecraft Wiki
- /clone Minecraft Wiki
New & updated guides ship every week. Follow the Atom feed or get notified when new Minecraft guides land.