ANSI Color Codes Reference
Complete reference for ANSI escape codes — 16 standard colors, 256-color palette, RGB true color, and text styles.
Text styles
\e[0m—Sample\e[1m\e[22mSample\e[2m\e[22mSample\e[3m\e[23mSample\e[4m\e[24mSample\e[7m\e[27mSample\e[9m\e[29mSampleClick a row to copy the escape sequence.
Standard 16 colors — foreground / background
256-color mode
Use \e[38;5;<n>m for foreground and \e[48;5;<n>m for background, where n is 0–255.
0–15
Standard 16 colors (same as above)
16–231
6×6×6 RGB color cube
232–255
24 grayscale shades (dark → light)
Click any swatch to copy its foreground escape sequence.
True color (24-bit RGB)
Use \e[38;2;R;G;Bm for foreground and \e[48;2;R;G;Bm for background.
Common examples
Red text
\e[31mRed text\e[0mBold + green
\e[1;32mBold Green\e[0mWhite on blue
\e[97;44mWhite on Blue\e[0m256-color fg (orange)
\e[38;5;208mOrange\e[0m256-color bg (purple)
\e[48;5;129mPurple bg\e[0mTrue color fg
\e[38;2;255;165;0mOrange RGB\e[0mHow ANSI escape codes work
ANSI escape codes are byte sequences recognized by most terminals (Linux, macOS, Windows Terminal) to format output — colours, bold, italic, underline. The format is ESC[<code>m where ESC is the escape character (byte 0x1B, written as \e in bash/zsh or \033 in C). Always reset with \e[0m after coloured output to avoid leaking styles.
For a quick way to add color to shell scripts, see Bash Color Codes. To encode binary data, use the Base64 Encoder.
Private & free — this tool runs entirely in your browser.