256-color palette — every xterm color index, copyable as an SGR escape
The xterm 256-color palette is what most terminals fall back to when an app emits an indexed color via \x1b[38;5;<n>m (foreground) or \x1b[48;5;<n>m (background). It splits into three regions: the 16 standard ANSI system colors (0–15), a 6×6×6 RGB cube (16–231), and a 24-shade grayscale ramp (232–255). Pick a mode below, then tap any swatch to copy the matching escape sequence to your clipboard.
Indices 0–15 — system colors
The 8 standard ANSI colors (0–7) and their bright/bold counterparts (8–15). The hex values shown are the xterm defaults; many terminals theme this region — these indices map to a user-customizable palette in practice. Indices 8–15 are also reachable via the simpler bright-color SGR codes 90–97 / 100–107 without going through 38;5 / 48;5.
Click any swatch to copy its escape sequence (e.g. \x1b[38;5;196m for foreground 196).
Indices 16–231 — 6×6×6 RGB cube
216 colors arranged as a 6×6×6 cube. Each axis (R, G, B) has 6 steps drawn from the non-linear ramp [0, 95, 135, 175, 215, 255]. Decode formula: idx = 16 + 36·R + 6·G + B, where R, G, B ∈ 0..5. The non-linear spacing concentrates resolution in the bright end where the eye discriminates better.
R=0 · G across · B down
Click any swatch to copy its escape sequence (e.g. \x1b[38;5;196m for foreground 196).
R=1 · G across · B down
Click any swatch to copy its escape sequence (e.g. \x1b[38;5;196m for foreground 196).
R=2 · G across · B down
Click any swatch to copy its escape sequence (e.g. \x1b[38;5;196m for foreground 196).
R=3 · G across · B down
Click any swatch to copy its escape sequence (e.g. \x1b[38;5;196m for foreground 196).
R=4 · G across · B down
Click any swatch to copy its escape sequence (e.g. \x1b[38;5;196m for foreground 196).
R=5 · G across · B down
Click any swatch to copy its escape sequence (e.g. \x1b[38;5;196m for foreground 196).
Indices 232–255 — grayscale ramp
24 steps from near-black to near-white, with value = 8 + 10·(idx − 232). Note that black (0,0,0) and white (255,255,255) are NOT in this range — they live at indices 16 and 231 inside the cube, and at indices 0 and 15 inside the system palette.
Click any swatch to copy its escape sequence (e.g. \x1b[38;5;196m for foreground 196).
How the palette is encoded
0–15System palette — the 16 colors every terminal ships with. Reachable via SGR 30–37 / 40–47 (normal) and 90–97 / 100–107 (bright), and also via 38;5;n / 48;5;n with n ∈ 0..15.
16–231RGB cube — six levels per channel, encoded as 16 + 36·R + 6·G + B. Output via 38;5;n (foreground) or 48;5;n (background).
232–255Grayscale ramp — 24 evenly-spaced gray shades. Output via 38;5;n / 48;5;n with n ∈ 232..255.