Skip to main content
ansicode

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[\x1b[21m
\\033[\033[21m
\\e[\e[21m
ESC [ESC [ 21 m
hex1b 5b 32 31 6d

Live preview

Rendered in your browser via the same tokeniser the decoder uses — no terminal needed.

Double underline

Description

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

bash
printf '\033[21mdouble underline\033[24m back\033[0m\n'
python
print('\x1b[21mdouble underline\x1b[0m')
go
fmt.Print("\x1b[21mdouble underline\x1b[0m")
javascript
console.log('\x1b[21mdouble underline\x1b[0m')
c
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
yes
GNU screen
yes

Related sequences

In the family cookbook

SGR cookbook · 6. SGR colon sub-params — the standards-correct form