Skip to content
FreeCodes
Minecraft key art showing mobs above a grass landscape

Minecraft

Minecraft Commands: 26 Essentials for Java & Bedrock

By FreeCodes TeamUpdated

  • 26 commands
  • Java · Bedrock
  • 10 game rules

Minecraft does not have cheat codes the way GTA does. It has commands — typed into the chat window, with their own syntax and their own permission rules. Two things decide whether one works: cheats must be enabled for that world, and you need the right operator level.

Java and Bedrock are genuinely different. They spell arguments differently, some commands exist on only one, and Java changed every game rule name in 1.21.11. Use the edition switch below and you will only ever see syntax that applies to the version you are playing.

Game rules were renamed in Java 1.21.11

Java moved every game rule into a registry and switched from camelCase to snake_case, so keepInventory is now keep_inventory. Some were renamed outright — doDaylightCycle became advance_time. Bedrock was not affected. Most guides still list only the old names, which is why the table below carries all three.

Turning cheats on

  1. Java Edition — new world

    1. 1On the world creation screen, open More World Options.
    2. 2Set Allow Cheats to ON, then create the world.
    3. 3Press T or / in game to open the chat, then type the command.
  2. Java Edition — existing world

    1. 1Pause the game and choose Open to LAN.
    2. 2Set Allow Cheats to ON and start the LAN world.
    3. 3Commands work until you quit. Repeat next session — this does not permanently enable cheats.
  3. Bedrock Edition

    1. 1Pause, open Settings, then the Game tab.
    2. 2Turn on Activate Cheats. Bedrock warns that achievements are disabled for that world.
    3. 3Open the chat and type the command.
  4. Realms and servers

    1. 1You must be an operator. Commands are refused otherwise.
    2. 2On a server, an admin runs /op <player> from the console.
    3. 3Permission levels differ by edition — most commands need level 2 on Java but only level 1 on Bedrock.

Command reference

Syntax is copied from the official wiki, per edition. Angle brackets are required arguments; square brackets are optional.

Showing 26 commands · Java syntax

/gamemode

PlayerOP 2

Switches a player between survival, creative, adventure and spectator.

/gamemode <gamemode> [<target>]
  • survivalBedrock also accepts s or 0
  • creativeBedrock also accepts c or 1
  • adventureBedrock also accepts a or 2
  • spectator
  • defaultBedrock only — also d or 5

/give

ItemsOP 2

Puts an item straight into a player’s inventory.

/give <targets> <item> [<count>]

Bedrock takes extra data and component arguments that Java does not.

/teleport

PlayerOP 2

Moves a player or entity to coordinates, or to another entity.

/teleport <destination>/teleport <targets> <destination>/teleport <targets> <location>/teleport <targets> <location> <rotation>/teleport <targets> <location> facing <facingLocation>

/tp is an alias for the same command.

/time

WorldOP 2

Sets or advances the world clock.

/time set (<time>|<timemarker>)/time add <time>/time query <timeline>
  • day1,000 ticks
  • noon6,000 ticks
  • night13,000 ticks
  • midnight18,000 ticks
  • sunrise23,000 ticks — Bedrock only
  • sunset12,000 ticks — Bedrock only

sunrise and sunset are Bedrock-only presets. On Java use the tick number.

/weather

WorldOP 2

Sets the weather, optionally for a fixed duration.

/weather (clear|rain|thunder) [<duration>]
  • clear
  • rainsnowfall in cold biomes
  • thunderblizzard in cold biomes

Bedrock adds `weather query`, which Java does not have.

/effect

PlayerOP 2

Applies or clears a status effect such as Speed, Night Vision or Strength.

/effect give <targets> <effect> [<seconds>] [<amplifier>] [<hideParticles>]/effect give <targets> <effect> infinite [<amplifier>] [<hideParticles>]/effect clear [<targets>] [<effect>]

Java uses an explicit `give` or `clear` sub-command; Bedrock does not.

/gamerule

WorldOP 2

Changes a world rule — keeping your inventory on death, freezing the clock, and so on.

/gamerule <rule name> [<value>]

Rule names differ between editions, and Java renamed all of them in 1.21.11. See the table below.

/kill

EntitiesOP 2

Instantly kills players or entities.

/kill [<targets>]

With no target it kills you. Cheat-only on Bedrock.

/summon

EntitiesOP 2

Spawns any entity — a mob, a lightning bolt, an item frame.

/summon <entity> [<pos>] [<nbt>]

/enchant

ItemsOP 2

Adds an enchantment to the item a player is holding.

/enchant <targets> <enchantment> [<level>]

Bedrock also accepts a numeric enchantment ID; Java does not.

/difficulty

WorldOP 2

Sets the world difficulty.

/difficulty [peaceful|easy|normal|hard]
  • peacefulBedrock: p or 0
  • easyBedrock: e or 1
  • normalBedrock: n or 2
  • hardBedrock: h or 3

Since 1.13 Java accepts full names only. Bedrock still takes shortcuts and numbers.

/clear

ItemsOP 2

Empties a player’s inventory, or removes one specific item.

/clear [<targets>] [<item>] [<maxCount>]

/xp

PlayerOP 2

Gives, sets or queries experience levels and points.

/experience add <targets> <amount> [levels|points]/experience set <targets> <amount> [levels|points]/experience query <targets> (levels|points)

Java spells it /experience with /xp as an alias. Bedrock only has /xp, and marks levels by suffixing the number with L — /xp 3L Alice.

/setblock

BlocksOP 2

Replaces a single block at given coordinates.

/setblock <pos> <block> [destroy|keep|replace|strict]

/fill

BlocksOP 2

Fills a whole cuboid region with one block.

/fill <from> <to> <block> [outline|hollow|destroy|strict|replace|keep]/fill <from> <to> <block> replace <filter> [outline|hollow|destroy|strict]

/clone

BlocksOP 2

Copies a region of blocks and pastes it somewhere else.

/clone <begin> <end> <destination> [replace|masked] [force|move|normal]/clone from <sourceDimension> <begin> <end> to <targetDimension> <destination> [strict] [replace|masked] [force|move|normal]

Java can clone across dimensions with the `from … to` form. Bedrock cannot.

/locate

WorldOP 2

Reports the coordinates of the nearest structure or biome.

/locate structure <structure>/locate biome <biome>/locate poi <poi>

Java adds `locate poi` for points of interest, which Bedrock does not have.

/seed

WorldOP 2

Prints the world seed.

/seed

Java only — the wiki states it is not available in Bedrock, where the seed is shown in world settings instead. Permission level is 0 in single-player and 2 on a server.

/spawnpoint

PlayerOP 2

Sets where a player respawns.

/spawnpoint [<targets>] [<pos>] [<angle>]

Works in any dimension, and can set a spawn point into another dimension.

/setworldspawn

WorldOP 2

Moves the world spawn — where new players start.

/setworldspawn [<pos>] [<angle>]

/title

DisplayOP 2

Shows large text across a player’s screen.

/title <targets> (title|subtitle|actionbar) <title>/title <targets> times <fadeIn> <stay> <fadeOut>/title <targets> (clear|reset)

/playsound

DisplayOP 2

Plays any game sound at a position.

/playsound <sound> [<source>] [<targets>] [<pos>] [<volume>] [<pitch>] [<minVolume>]

Java requires a sound source category; Bedrock does not have that argument.

/particle

DisplayOP 2

Spawns particle effects.

/particle <name> [<pos>]/particle <name> <pos> <delta> <speed> <count> [force|normal] [<viewers>]

Java takes spread, speed and count. Bedrock takes only the effect and a position.

/say

ServerOP 2

Broadcasts a message to everyone in chat.

/say <message>

/op

ServerOP 3

Grants operator status, which is what lets someone use commands at all.

/op <targets>

Dedicated servers only. Note the higher permission level — level 3 on Java, 2 on Bedrock.

/kick

ServerOP 3

Removes a player from the server, with an optional reason.

/kick <targets> [<reason>]

Server only, and cannot kick a single-player or LAN host. Java requires level 3.

Game rules, old and new names

Use it as /gamerule <name> <value>. Pick the column that matches what you are playing.

What it doesJava 1.21.11+Java, olderBedrockDefault
Keep your items on deathkeep_inventorykeepInventorykeepinventoryfalse
Freeze the day/night cycleRenamed outright on Java, not just re-cased.advance_timedoDaylightCycledodaylightcycletrue
Stop mobs spawningRenamed outright on Java.spawn_mobsdoMobSpawningdomobspawningtrue
Stop creepers and endermen wrecking blocksmob_griefingmobGriefingmobgriefingtrue
Freeze the weatherRenamed outright on Java.advance_weatherdoWeatherCycledoweathercycletrue
Respawn instantly, no death screenimmediate_respawndoImmediateRespawndoimmediaterespawnfalse
Turn off health regenerationRenamed outright on Java.natural_health_regenerationnaturalRegenerationnaturalregenerationtrue
Speed up crop growthrandom_tick_speedrandomTickSpeedrandomtickspeed3 on Java, 1 on Bedrock
Stop fire spreadingThe rule exists on Java, but we could not confirm its post-1.21.11 name, so it is left blank rather than guessed.not confirmeddoFireTickdofireticktrue
Show coordinates on screenBedrock only. On Java, press F3 instead.not confirmedshowcoordinatestrue
Minecraft characters on a bridge at sunset
Commands work in any world with cheats enabled. Artwork: Mojang Studios.

Frequently Asked Questions

Why does /gamerule keepInventory no longer work?

Java Edition 1.21.11 moved every game rule into a registry and renamed them from camelCase to snake_case, so keepInventory became keep_inventory. The old names are deprecated and may still resolve on some versions, but on current Java you should use /gamerule keep_inventory true. Bedrock was not affected and still uses keepinventory.

Do commands disable achievements?

On Bedrock, turning on Activate Cheats disables achievements for that world permanently, and the game warns you before it happens. Java Edition has advancements rather than achievements, and using commands does not lock them.

What is the difference between Java and Bedrock command syntax?

Bedrock spells out argument types in its syntax, such as <player: target>, while Java writes plain placeholders like <targets>. Some commands genuinely differ too: Java splits /effect into give and clear sub-commands, Bedrock adds /weather query, and sunrise and sunset are Bedrock-only presets for /time set.

Why do I get "You do not have permission to use this command"?

Cheats are off, or you are not an operator. On a single-player world turn cheats on, or use Open to LAN on Java. On a server or Realm an admin has to op you. Most commands need permission level 2 on Java and level 1 on Bedrock.

Can I enable cheats on an existing Java world without losing anything?

Yes. Pause, choose Open to LAN, set Allow Cheats to ON and start it. Nothing is lost and the world stays single-player, but the setting only lasts for that session — you repeat it each time you load the world.

Do these commands work on Minecraft Education or the Netflix edition?

Those are built on Bedrock, so the Bedrock syntax generally applies. Education Edition adds its own commands and restricts some others depending on how the classroom world is configured.

How this list was checked

Every syntax line was copied from that command’s own page on the official Minecraft wiki rather than written from memory, and the 1.21.11 game rule renames were confirmed against a second independent source. One rule — stopping fire spreading — has no confirmed post-1.21.11 Java name, so that cell is left blank rather than filled with a guess.

This is the 26 commands people actually reach for, not every command in the game — Minecraft has well over a hundred, including the scripting ones like /execute and /scoreboard. Want one added? Tell us and it goes on the list.

Comments

Loading comments…