Skip to main content
ansicode

SGR 3 — Italic

Render following text in italic; not universally supported.

Byte forms

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

\\x1b[\x1b[3m
\\033[\033[3m
\\e[\e[3m
ESC [ESC [ 3 m
hex1b 5b 33 6d

Live preview

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

Italic text

Description

Italic switches the rendered glyphs to the italic variant of the current font face. On terminals that honor it — xterm, iTerm2, kitty, alacritty, wezterm, ghostty, Windows Terminal, modern gnome-terminal and konsole — the resulting look depends entirely on the user's font choice. Monospace italics range from carefully designed (JetBrains Mono, Cascadia Code, Iosevka) to barely-slanted hacks where the terminal synthesizes a slant via skew transform; many users disable italic globally because they find the synthesized version illegible.

It is the most fragile of the basic SGR attributes. The Linux console / fbcon has no italic glyph in framebuffer mode (the kernel only loads PSF/PSF2 normal + bold faces via setfont), so SGR 3 parses as a no-op — neovim, man, and less simply display plain text. Legacy cmd.exe and ConPTY also drop it. A historical hazard: a few very old terminals (and one terminfo cap, ritm/sitm mis-mapping on vt100-like entries) reuse parameter 3 for reverse video on monochrome hardware — extremely rare today, but worth knowing if you see italic rendering as inverse on niche hardware. tput's sitm / ritm capabilities are the portable way to emit / clear italic when you cannot assume the terminal supports it; on linux/linux-16color they expand to empty strings, on xterm-256color to \e[3m / \e[23m.

Disable italic with \x1b[23m. Do not rely on \x1b[0m (full reset) just to close an italic span — that clobbers color and weight as well; the surgical close-pair is \x1b[3m…\x1b[23m. If your audience includes Linux-console users, prefer sgr-underline for emphasis (it renders everywhere SGR 3 doesn't) and keep italic for cases where the visual nuance is bonus, not load-bearing.

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

Examples

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

Used in

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

  • vim, neovimdefault Comment syntax group in most colourschemes
  • bat (markdown rendering)
  • git log --prettyauthor email in some custom formats
  • less status / search emphasis

Frequently asked

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

Why isn't \x1b[3m rendering italic in my terminal?
Three likely causes: (1) the font has no italic style, so the terminal silently falls back to upright glyphs — pick a font with an italic face (JetBrains Mono, Cascadia Code, Fira Code all ship one); (2) the terminal explicitly doesn't implement SGR 3 — Linux framebuffer console and older Windows console hosts skip it; (3) tmux's default-terminal is set to screen (which advertises no italic in terminfo) — switch to tmux-256color or screen-256color.
Does \x1b[23m cancel italic without losing other attributes?
Yes — \x1b[23m is the surgical italic-off disable. It leaves colour, weight, underline, reverse, and every other SGR state intact. Pair \x1b[3m…\x1b[23m whenever you only want a transient italic span inside otherwise-styled text.

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