Start here

Command basics

Three things to know before your first command: how commands are built, how coordinates work, and who target selectors point at.

1 - Anatomy

How a command is built

/give @s diamond 64
/give

the command

@s

the target (who)

diamond

the item

64

how many

Read it left to right: command → target → details. Parts in <…> are required, […] are optional.

2 - Coordinates

Finding your way: X, Y, Z

X

east (+) / west (−)

Y

up (+) / down (−) - height

Z

south (+) / north (−)

💡 See your coordinates: press F3 on Java, or turn on Show Coordinates in Bedrock world settings.
100 64 -200

Absolute

Exact spot in the world.

~ ~ ~

Relative (~)

Your current position.

~ ~5 ~

Relative + offset

Same spot, 5 blocks up.

^ ^ ^3

Local (^)

Relative to where you're facing - 3 blocks ahead.

3 - Target selectors

Who does it affect?

Selectors start with @ and choose who a command targets. Pick one below and watch who lights up.

command runs here
🧑
Alex
🧑‍🦰
Sam
🐄
Cow
🐄
Cow
🧟
Zombie

Go deeper

Beyond the basics

Command blocksRun commands from inside the world, automatically.

Grab one in Creative (you need operator permissions):

/give @s command_block

Place it, then right-click to open it and type a command (no leading / needed inside the block). Three types:

  • Impulse - runs once each time it gets a redstone pulse.
  • Repeat - runs every tick while powered or “Always Active”.
  • Chain - runs right after the block pointing into it runs.

Toggle Needs Redstone / Always Active and Conditional in the block's UI.

NBT & data tagsExtra data attached to entities, blocks, and items.

NBT is the extra data you can add in {curly braces}. On entities it still works directly:

/summon zombie ~ ~ ~ {CustomName:'"Bob"',IsBaby:true}

For items, newer Java (1.20.5+) switched from NBT tags to components in [square brackets]:

/give @s diamond_sword[enchantments={sharpness:5}]

Older Java versions used {Enchantments:[...]}, and Bedrock handles this differently - always match your version.

/execute deep diveThe command that powers almost every advanced trick.

Chain subcommands to set context, then run a command inside it:

/execute as @a at @s run tp ~ ~5 ~
  • as <targets> - change who @s refers to.
  • at <targets> - change where the command runs from.
  • positioned / rotated / facing - fine-tune the spot and direction.
  • if / unless - only run when a condition is true (entity, block, score).
  • store - save the result into a score or NBT.

The example above bounces every player 5 blocks up - one command, run once per player, from each player's position.

Build your first commandPut it all together, step by step.
  1. Open chat with T (or /) - or place a command block.
  2. Type / and start the command name (try the autocomplete in our simulator).
  3. Add a target selector, like @s.
  4. Fill in the rest - coordinates, items, amounts.
  5. Press Enter and watch it happen.

Stuck on a specific one? Every command page here has examples, common mistakes, and a live preview.