Skip to main content
ansicode

SGR 2 — Dim / Faint

Render following text at reduced intensity (faint).

Byte forms

Every common string-literal form so you can paste-and-search either direction.

\\x1b[\x1b[2m
\\033[\033[2m
\\e[\e[2m
ESC [ESC [ 2 m
hex1b 5b 32 6d

Live preview

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

Dim text

Description

ECMA-48 §8.3.117 names SGR 2 "faint, decreased intensity, or second colour". The byte sequence is \x1b[2m — CSI followed by 2 then the final byte m. The spec is deliberately loose about the visual treatment ("characters intended for emphasis... of decreased intensity"), which is why implementations vary: most modern GUI emulators alpha-blend the foreground toward the background at roughly 60% opacity (xterm, iTerm2, kitty, alacritty, wezterm, gnome-terminal, Konsole, Ghostty), older xterm builds map it to a greyed-out colour swap, and the framebuffer Linux console ignores it. SGR 22 (\x1b[22m) is the matching close — and importantly the *same* close as sgr-bold, because the spec treats bold / normal / faint as a single three-state intensity attribute.

Visibility on light themes is the most common surprise: alpha-blending a near-white foreground toward a near-white background gives near-white text — barely distinguishable from non-faint. Dark themes show the effect much more clearly because grey-on-black has obvious contrast. Linux console / fbcon ignores SGR 2 entirely (the 16-slot kernel palette has no intermediate-intensity slot), Windows legacy cmd.exe pre-ConPTY does the same, and ConPTY 1809+ forwards it through to the outer terminal (so Windows Terminal renders it correctly, but the same binary writing to the legacy console host won't). The terminfo cap is dim — tput dim is the portable spelling, but many terminfo entries leave dim empty even when the emulator implements it, so probing via [ -n "$(tput dim)" ] underreports. tmux passes SGR 2 through unmodified.

Disable with SGR 22 (\x1b[22m). The catch: SGR 22 *also* clears bold — so if you stacked \x1b[1;2m (bold + faint, a sometimes-useful "dim emphasis" combination), \x1b[22m returns to normal intensity entirely. To keep bold while un-dimming, the only portable path is \x1b[0m\x1b[1m (full reset + re-apply bold) — there is no surgical "un-faint but keep bold" parameter. Never use dim as the sole signal for "less important" content: the color-only-signal pitfall extends to intensity-only signals (screen readers ignore the attribute entirely, low-vision users on light themes may not see the contrast). Related: sgr-bold (SGR 1 — the other intensity endpoint sharing the SGR 22 close), sgr-reset (SGR 0 — full reset), sgr-italic (SGR 3 — adjacent style attribute commonly mixed with faint for inline metadata).

Spec citation: ECMA-48 §8.3.117 (SGR parameter 2)

Examples

bash
printf '\033[2mfaint\033[22m back\033[0m\n'
python
print('\x1b[2mfaint\x1b[0m')
go
fmt.Print("\x1b[2mfaint\x1b[0m")
javascript
console.log('\x1b[2mfaint\x1b[0m')
c
printf("\x1b[2mfaint\x1b[0m\n");

Used in

Real-world tools that emit this sequence — anchors the bytes to commands you've already used.

  • git log --onelineabbreviated commit hash in dim grey
  • starship secondary segments (jobs, hostname)
  • bat line-number gutter
  • delta (git diff pager) line numbers

Frequently asked

Short answers to the questions developers actually search for this sequence.

Why does \x1b[2m look identical to normal text on macOS Terminal.app?
ECMA-48 §8.3.117 deliberately leaves the visual treatment loose ('decreased intensity'), so there's no spec-mandated dim amount. Terminal.app's implementation alpha-blends only slightly, and on a low-contrast theme the result is barely distinguishable from undimmed text. iTerm2, kitty, alacritty, wezterm, ghostty blend at roughly 60% opacity — the same code renders clearly dim there. Switch terminals or pick a higher-contrast theme; don't rely on SGR 2 as the sole signal for 'less important' content.
Does \x1b[22m cancel dim, or only bold?
Both. ECMA-48 treats bold (SGR 1) / normal (default) / dim (SGR 2) as a single three-state intensity attribute, so \x1b[22m ('normal intensity') clears whichever of bold or dim was active. There's no parameter that turns off dim while keeping bold — to do that, emit \x1b[0m then re-apply bold with \x1b[1m.

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

Related sequences