Updated:

The three kinds

WrittenNameBased on
100 64 -200AbsoluteA fixed spot in the world
~ ~1 ~RelativeOffsets along X (east-west), Y (up-down), Z (north-south)
^ ^ ^5LocalOffsets to the left, up and forward from where you face

~ follows compass directions

/tp @s ~ ~10 ~
/tp @s ~5 ~ ~
/setblock ~ ~-1 ~ minecraft:gold_block

The numbers are X, Y, Z. East is +X, south is +Z, up is +Y. These move you 10 up, 5 east, and turn the block under your feet to gold, whichever way you face. A bare ~ means no offset.

^ follows where you look

/tp @s ^ ^ ^5
/tp @s ^-3 ^ ^
/summon minecraft:arrow ^ ^1 ^2

The numbers are left, up, forward. Use negatives for right or backward. Looking up makes "forward" point at the sky, which is why ^ suits dashes and projectiles.

Do not mix ~ and ^

~ ~ ^5 is an error. You can mix ~ with plain numbers (~ 64 ~), but ^ must be used for all three.

^ in command blocks

A command block has no facing of its own, so ^ always uses the same default direction. To use a player's facing, switch to them first:

/execute as @p at @s run tp @s ^ ^ ^3

as @p takes the player's rotation and at @s their position, so they move three blocks the way they face.

Measure from the eyes (Java)

/execute anchored eyes run setblock ^ ^ ^3 minecraft:glass

Local coordinates start at the feet. anchored eyes starts them at eye level, so the block lands where you are looking.

Move forward but stay level (Java)

/execute rotated ~ 0 run tp @s ^ ^ ^3

rotated ~ 0 keeps your left-right facing but sets the up-down angle to 0, so you move horizontally even while looking up.

Common mix-ups

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.