SGR 8 — Conceal / Hidden
Render following text invisibly (cursor still advances).
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\\x1b[
\x1b[8m\\033[
\033[8m\\e[
\e[8mESC [
ESC [ 8 mhex
1b 5b 38 6dDescription
Sets the foreground to be visually identical to the background — the text still occupies cells and is preserved by select-all/copy. Useful for spoiler tags or password-style display, but NOT a security primitive: the text is copyable. Disable with \x1b[28m. Most modern terminals honor it; Linux console and ConPTY treat it as a no-op.
Spec citation: ECMA-48 §8.3.117 (SGR parameter 8)
Examples
printf 'password: \033[8mhunter2\033[28m (select to reveal)\033[0m\n'print('\x1b[8mhidden\x1b[0m')fmt.Print("\x1b[8mhidden\x1b[0m")console.log('\x1b[8mhidden\x1b[0m')printf("\x1b[8mhidden\x1b[0m\n");Frequently asked
Short answers to the questions developers actually search for this sequence.
- Why does
\x1b[8m-hidden text show up when I copy it out of the terminal? - Conceal hides the *rendered glyphs* — the text bytes still sit in the terminal's cell buffer, and selection / copy reads from that buffer, not from what's painted on screen. Terminal-screen tools behave the same way (screen-scrapers, accessibility readers,
tmux capture-pane). Treat SGR 8 as a *display* obfuscation, never a security boundary — fine for the classic CTF-style hidden flag, never for passwords or secrets. - Does
\x1b[8msurvivescriptorasciinemarecordings? - Yes — both tools record the raw byte stream the application emitted, including SGR 8. Replaying through a terminal that honours conceal will hide the text on screen; piping the recording through
cat -Aorsed 's/\x1b\[[0-9;]*m//g'reveals the underlying bytes. SGR 8 is a render-time directive, not a storage transform.
Terminal support
- xterm
- yes
- Linux console (fbcon)
- no
- macOS Terminal.app
- yes
- iTerm2
- yes
- Windows Terminal
- yes
- cmd.exe / ConPTY
- no
- kitty
- yes
- alacritty
- yes
- WezTerm
- yes
- Ghostty
- yes
- GNOME Terminal
- yes
- Konsole
- yes
- tmux
- yes
- GNU screen
- yes
| xterm | Linux console (fbcon) | macOS Terminal.app | iTerm2 | Windows Terminal | cmd.exe / ConPTY | kitty | alacritty | WezTerm | Ghostty | GNOME Terminal | Konsole | tmux | GNU screen |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| yes | no | yes | yes | yes | no | yes | yes | yes | yes | yes | yes | yes | yes |