Updated:

Place a sign with text

VersionCommand
Java 1.21.5+/setblock ~ ~ ~1 minecraft:oak_sign{front_text:{messages:["Welcome",{text:"Lobby this way",color:"red"},"",""]}}
Java 1.20–1.21.4/setblock ~ ~ ~1 minecraft:oak_sign{front_text:{messages:['"Welcome"','{"text":"Lobby this way","color":"red"}','""','""']}}

messages holds the four lines and must always have four entries, so write empty strings for unused lines. Since 1.20 signs have two sides: front_text and back_text. Versions before 1.20 used Text1 to Text4 instead.

Direction and sign type

Color, glowing text and wax

# Java 1.21.5+
/setblock ~ ~ ~1 minecraft:oak_sign{is_waxed:1b,front_text:{color:"yellow",has_glowing_text:1b,messages:["Notice","","",""]}}

Warp signs

# Java 1.21.5+
/setblock ~ ~ ~1 minecraft:oak_sign{is_waxed:1b,front_text:{messages:[{text:"[Go to lobby]",color:"aqua",click_event:{action:"run_command",command:"/tp @s 0 64 0"}},"","",""]}}
# Java 1.20–1.21.4 (the first line)
'{"text":"[Go to lobby]","color":"aqua","clickEvent":{"action":"run_command","value":"/tp @s 0 64 0"}}'

Clicking the text runs the command as the player who clicked. Unlike books and chat, sign clicks can run commands such as /tp for players without operator rights, which is why warp signs are a common server feature. In 1.21.5 clickEvent became click_event and value became command.

Give a pre-written sign

# Java 1.21.5+
/give @p minecraft:oak_sign[block_entity_data={id:"minecraft:sign",front_text:{messages:["Welcome","","",""]}}]

The sign already has its text when placed. block_entity_data needs id:"minecraft:sign" (minecraft:hanging_sign for hanging signs).

Bedrock Edition

Bedrock commands cannot set sign text. Write a sign by hand, save it with /structure, and load copies where you need them.

Common problems

Common questions

Check your command

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