Skip to main content

Double underline

AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Standard

Double underline (SGR 21) is an SGR attribute that renders text with two underlines below the baseline.

Syntax​

CSI 21 m    SGR 21 — Double underline
CSI 24 m SGR 24 — Not underlined
Formal syntax
SGR-double-underline = 0x1b, "[", "21", "m" ;
SGR-not-underline    = 0x1b, "[", "24", "m" ;

Description​

Per ECMA-48 §8.3.117, SGR parameter 21 selects "doubly underlined." Two parallel lines are drawn below the text baseline.

Double underline is reset by SGR 24 (which cancels all underline variants) or SGR 0.

SGR 21 can also be expressed as SGR 4:2 in the sub-parameter syntax defined by ITU-T T.416. Some terminals support one form but not the other.

Examples​

printf '\e[21mDouble underlined\e[24m Normal\n'
printf '\e[4:2mAlternate syntax\e[24m\n'

Specifications​

SpecificationSection
ECMA-48—

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✓v0.6.0
Bobcat??Implemented in external TerminalCtrl library, not in Bobcat source code
contour✓v0.1.0
foot✓YesImplemented at csi.c:131-136
Ghostty✓v1.0.0
iTerm2✓YesDouble underline (SGR 21) fully supported via VT100CHARATTR_DOUBLE_UNDERLINE and VT100UnderlineStyleDouble.
Kitty✓Yes
Konsole✓YesSGR 21 sets RE_UNDERLINE_DOUBLE
mintty✓YesImplemented at src/termout.c:2182-2184. Sets ATTR_DOUBLYUND flag. Also available via SGR 4:2 subparameter at src/termout.c:2133-2135.
mlterm✓rel-3_3_7
PuTTY✗NoSGR 21 falls through to SGR 4 (single underline) at terminal.c:4650-4655
Rio✓v0.0.3
rxvt-unicode✗NoCase 21 only disables bold, comment mentions 'sometimes doubly underlined' but not implemented
st✗NoSGR 21 maps to bold-off, not double underline
terminology✗NoSGR 21 resets bold instead of double underline
VT100✗No
VTE✓Yes
WezTerm✓Yes
Windows Terminal✓YesSGR 21 sets doubly underlined style
xterm✓YesECMA-48 3rd edition feature, requires OPT_WIDE_ATTRS
xterm.js✓4.10.0
Multiplexers
cy✗No
GNU Screen✗NoSGR 21 not supported (rendlist[21] = 0 at src/ansi.c:1704)
tmux✓2.9
tuios✓v0.5.0
Zellij✗NoSGR 21 is used to reset bold, not for double underline. Double underline is available via SGR 4:2 as part of styled underlines (v0.39.0+)

See also​