SGR 21 — Doubly underlined
Render text with a double underline — distinct from single underline (SGR 4).
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b[21m\033[21m\e[21mESC [ 21 m1b 5b 32 31 6dDescription
Double underline. ECMA-48 §8.3.117 defines SGR 21 as `DOUBLY UNDERLINED`. **Caveat**: historically some terminals (older xterm builds, certain Linux console fonts) treated SGR 21 as `BOLD OFF` instead — a vestige from when bold and double-underline were both intensity-related flags on hardware terminals. Modern xterm, kitty, wezterm, iTerm2, Windows Terminal, ghostty, alacritty all implement the ECMA-48 meaning. If you also need to support legacy terminals, use Kitty's underline-style extension `\x1b[4:2m` instead — it unambiguously means double underline and is supported by the same modern set plus kitty. Turn off with `\x1b[24m` (same disabler as single underline).
Spec citation: ECMA-48 §8.3.117 (SGR parameter 21)
Examples
printf '\033[21mdouble underline\033[24m back\033[0m\n'print('\x1b[21mdouble underline\x1b[0m')fmt.Print("\x1b[21mdouble underline\x1b[0m")console.log('\x1b[21mdouble underline\x1b[0m')printf("\x1b[21mdouble underline\x1b[0m\n");Terminal support
- xterm
- yes
- Linux console (fbcon)
- partial
- macOS Terminal.app
- no
- iTerm2
- yes
- Windows Terminal
- yes
- cmd.exe / ConPTY
- no
- kitty
- yes
- alacritty
- yes
- WezTerm
- yes
- Ghostty
- yes
- GNOME Terminal
- partial
- Konsole
- yes
- tmux
- no
- GNU screen
- no
| xterm | Linux console (fbcon) | macOS Terminal.app | iTerm2 | Windows Terminal | cmd.exe / ConPTY | kitty | alacritty | WezTerm | Ghostty | GNOME Terminal | Konsole | tmux | GNU screen |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| yes | partial | no | yes | yes | no | yes | yes | yes | yes | partial | yes | no | no |
Related sequences
In the family cookbook
SGR cookbook · 6. SGR colon sub-params — the standards-correct form