Skip to main content
ansicode

DCS Sixel — Inline raster graphics (ESC P q … ESC \)

Embed pixel images in the terminal stream using the Sixel device-control payload.

Byte forms

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

\\x1b[\x1bPq <sixel data> \x1b\\
\\033[\033Pq … \033\\
\\e[\eP q … \e\\
ESC [ESC P q DATA ESC \
hex1b 50 71 ... 1b 5c

Description

Sixel is a DEC-era inline pixel graphics format (DEC VT240/VT340) revived by modern terminals. The frame begins with the Device Control String introducer `\x1bP` (DCS), an optional parameter run, the `q` final byte that selects Sixel mode, then a payload of `?`..`~` printable characters where each byte encodes a 6-pixel-tall vertical slice (hence 'sixel'). The frame ends with the String Terminator — either `\x1b\\` (ST, spec-correct) or `\x07` (BEL, widely accepted). `libsixel`, `chafa`, `viu`, `timg`, `ranger`-style image previews, `kitten icat --transfer-mode=stream` (Sixel fallback for Kitty's native protocol), and `mpv --vo=sixel` all emit this sequence. Terminal support varies: xterm needs `+sb` compile and `-ti vt340`, mintty + foot + wezterm + iTerm2 + Windows Terminal Canary + ghostty work out of the box, kitty + alacritty + macOS Terminal do not (Kitty has its own better protocol).

Spec citation: DEC VT340 Programmer Reference / xterm-ctlseqs (DCS Ps; Ps; Ps q)

Examples

bash
# A 12x6 magenta block via the Sixel raw payload\nprintf '\033Pq#0;2;100;0;100#0~~\033\\'
python
import sys; sys.stdout.write('\x1bPq#0;2;100;0;100#0~~\x1b\\')
go
fmt.Print("\x1bPq#0;2;100;0;100#0~~\x1b\\")
javascript
process.stdout.write('\x1bPq#0;2;100;0;100#0~~\x1b\\')
c
printf("\x1bPq#0;2;100;0;100#0~~\x1b\\");

Terminal support

xterm
partial
Linux console (fbcon)
no
macOS Terminal.app
no
iTerm2
yes
Windows Terminal
partial
cmd.exe / ConPTY
no
kitty
no
alacritty
no
WezTerm
yes
Ghostty
yes
GNOME Terminal
partial
Konsole
yes
tmux
no
GNU screen
no

Related sequences

In the family cookbook

DCS cookbook · 2. Pictures inside the stream — Sixel and Kitty graphics