How to generate Minecraft commands that actually work (2026 playbook)
GuideJava 1.8 – 26.3 · Bedrock7 min read5 commands
The 6 rules that separate a command that works from one that throws “Expected whitespace”: pick the version first, components vs NBT, precise selectors, /execute chains, length limits and upgrading old commands.
Most broken commands are not typos. They are commands written for a different Minecraft. Mojang changed the command format four times since 2018, and a command from a video made two years ago is often wrong for the game you are playing today. These six rules are how we build every generator on this site — use them by hand, or let the generators do it for you.
1. Pick your edition and version before anything else
The same sword needs a different command depending on the version. Up to Java 1.20.4, item data lives in NBT inside curly braces. From 1.20.5 it lives in item components inside square brackets, and from 1.21.5 text such as names and lore is written as SNBT instead of JSON strings. Here is one sword, twice:
The classic NBT format in curly braces. Works up to Java 1.20.4 and fails on everything after.
give @p minecraft:diamond_sword{display:{Name:'{"text":"Excalibur","color":"gold","bold":true,"italic":false}',Lore:['{"text":"Pulled from the stone","color":"gray"}']},Enchantments:[{id:"minecraft:sharpness",lvl:5s}],Unbreakable:1b}Same sword, written with item components in square brackets — what 1.20.5 and every later version reads.
give @p minecraft:diamond_sword[custom_name={text:"Excalibur",color:"gold",bold:true,italic:false},lore=[{text:"Pulled from the stone",color:"gray"}],enchantments={"minecraft:sharpness":5},unbreakable={}]Paste the first one into 26.3 and you get an error at the first {. That is why every generator asks for the version first and only writes syntax that version reads. When something can’t exist in your version, it is left out with a note (“needs 1.20.5”, “Java only”) instead of producing a broken command.
2. Aim with selectors, not with luck
@e means every entity in loaded chunks — including your pets, item frames and armor stands. Narrow it every time: a type, a distance, a limit and a sort. Test with say first; it lists exactly who the selector found.
The three nearest zombies within 20 blocks — and nobody else. Lists them in chat so you can check before you change it to kill.
say @e[type=zombie,distance=..20,sort=nearest,limit=3]Build these in the target selector generator: it knows that Bedrock uses c=3 where Java uses limit=3,sort=nearest, and that @n only exists from Java 1.21.
3. Chain conditions with /execute
Almost every “how did they do that” map trick is one /execute line: pick who runs it (as), where (at), add conditions (if block, if entity, if score), then run the command. Put it in a repeating command block and it checks every tick.
Every player standing on sand gets a burst of flame particles at their feet. One line, runs every tick in a repeating command block.
execute as @a at @s if block ~ ~-1 ~ sand run particle minecraft:flame ~ ~0.2 ~ 0.3 0 0.3 0.01 64. Mind the length limit
Chat accepts 256 characters; a command block takes 32,767. Long /give and /summon commands only fit in a command block — the generators show the length and warn you before you hit the wall.
5. Make text interactive
/tellraw text can carry hover tooltips and click actions on Java: run a command, suggest one, open a link or copy to the clipboard. It is the cheapest way to make a map feel like a real game.
A chat message with a hover tooltip and a button that types /spawn for the player. Copy it into a command block at your spawn.
tellraw @a ["",{text:"Welcome back! ",color:"gold",bold:true},{text:"[Go to spawn]",color:"aqua",underlined:true,click_event:{action:"suggest_command",command:"/spawn"},hover_event:{action:"show_text",value:"Click to type /spawn"}}]6. Upgrade old commands instead of rewriting them
Found a perfect command on a forum from 2019? Open its generator and use Paste a command. It reads every old format back into the form, shows a diff of what changes, and writes it again for your version. Or skip the form: type what you want in plain words (“a netherite axe with Efficiency V that never breaks”) and the AI fills the form for your version — every field still editable.
Checklist
- Edition and version chosen first.
- Every selector has a type, a distance or a tag, and a limit.
- Tested with
saybeforekill. - Long commands go in a command block, not chat.
- Old commands pasted into the generator, not edited by hand.
More drops
- Next drop · A giant King Cube, a wobbling cube tower and the new bounciness attribute.Java 26.2+ · Chaos Cubed · 8 commands