Minecraft Command Generator
Pick a command, fill in the boxes and copy a command that works first time. Choose Java or Bedrock and the generator writes the right syntax for that edition.
Command
Options
Your command
How to use the command generator
- Pick the command you need, such as Effect, Summon or Game rule.
- Choose your edition and version. Most commands are the same everywhere, but game rule names, entity data and a few arguments differ between Java versions and Bedrock.
- Fill in the options. The command updates as you type.
- Copy it and paste it into chat (press T, or / on Java), or into a command block for long commands.
Commands need cheats: turn on "Allow Cheats" when you create a world, or open the world to LAN with cheats on. On a server you need operator permission (/op YourName from the console).
Target selectors
| Selector | Means | Example |
|---|---|---|
@p | Nearest player | /gamemode creative @p |
@s | You (whoever runs the command) | /effect give @s night_vision infinite |
@a | All players | /tp @a 0 100 0 |
@r | A random player | /give @r diamond |
@e | All entities, filtered with [type=…] | /kill @e[type=item] |
Game rules were renamed in Java 1.21.11
Java Edition 1.21.11 changed every game rule to lowercase names with underscores, and some got clearer names at the same time. If a game rule command from a video or old guide says "Incorrect argument", this is usually why.
| Java 1.21.11 and newer | Java 1.21.10 and older | Bedrock |
|---|---|---|
keep_inventory | keepInventory | keepinventory |
advance_time | doDaylightCycle | dodaylightcycle |
advance_weather | doWeatherCycle | doweathercycle |
spawn_mobs | doMobSpawning | domobspawning |
spawn_phantoms | doInsomnia | doinsomnia |
natural_health_regeneration | naturalRegeneration | naturalregeneration |
block_drops | doTileDrops | dotiledrops |
show_advancement_messages | announceAdvancements | – |
Popular commands
- Keep your items when you die:
/gamerule keep_inventory true(Java 1.21.11+) or/gamerule keepInventory trueon older versions. - Stop the day–night cycle:
/gamerule advance_time false, then/time set noon. - See in the dark forever:
/effect give @s night_vision infinite 0 true. - Clear lag from dropped items:
/kill @e[type=item].
Need a custom sword, armour or tool? Use the give command generator. For chat messages and on-screen titles, see the tellraw and title generators.
Frequently asked questions
How do I use commands in Minecraft?
Open chat with T (or / on Java) and paste the command. In single player you need cheats turned on; on a server you need operator permission. Long commands can go in a command block instead.
Are commands the same on Java and Bedrock?
Mostly, but not always. Some commands have different arguments, and Bedrock has no data components or NBT for items. Choose your edition and the generator writes the right version.
What does @p, @a, @s and @e mean?
They are target selectors: @p is the nearest player, @a is all players, @s is yourself (the one running the command), @r is a random player and @e is all entities.
Why is my command too long for chat?
Chat accepts 256 characters. Longer commands must go in a command block, which accepts up to 32,500 characters.