Skip to content

Underline (SGR 4)

Category: sgr · Baseline: core · Tags: ECMA-48 Standard, VT100 · Specification ↗

ESC [ 4 m
SGR 4 draws a single underline beneath text. The sequence is ESC [ 4 m. One of the original VT100 attributes, universally supported across terminals. Reset with SGR 24. Underline was one of the original hardware-friendly emphasis attributes: it worked on monochrome terminals where color was unavailable. Modern terminals still treat SGR 4 as the compatibility floor for diagnostics, links, and emphasis. Richer underline styles build on top of this convention, but SGR 4 remains the fallback every app can expect.
How this is testedautomated
Send \x1b[4mX, verify the cell has a truthy underline attribute.

The same probe runs against headless backends (via Termless) and real terminal apps (via a daemon launched in each terminal). This lets us distinguish parser correctness from rendering correctness.

Analysis2026-05-17

Supported by all 12 tested terminals — universal adoption. Part of the Core TUI baseline.

Supported by 14 of 14 backends (100%)

Terminal Applications

TerminalVersionSupportNotes
iTerm23.6.9✓ yes
Ghostty1.3.1✓ yes
VS Code✓ yes
Warp✓ yes
Kitty0.46.2✓ yes
Cursor✓ yes
Terminal.app✓ yes

Headless Backends

Parser correctness only — a means the parser accepts the sequence.

BackendVersionSupportNotes
Alacritty0.26.0✓ yes
vt100.js0.2.1✓ yes
vterm.js0.2.0✓ yes
WezTerm0.1.0-fork.5✓ yes
xterm.js5.5.0✓ yes