ANSI Color Code Generator
Generate ANSI color codes for 16-color, 256-color, and truecolor terminal output with a live preview. Build SGR escape sequences with bold, underline, and more, then copy raw or \x1b-escaped strings for bash, Python, and JavaScript. Free and fully in-browser.
Loading tool...
What is ANSI Color Code Generator?
The ANSI Color Code Generator builds terminal escape sequences for colored and styled text. Choose colors from the standard 16-color palette, the 256-color index, or truecolor RGB, combine them with text styles, preview the result live, and copy a sequence ready for scripts and CLI output.
Key Benefits
- No memorizing SGR codes
- Live terminal-style preview
- Raw and escaped copy formats
- Works offline in the browser
Common Use Cases
- •Shell script output
- •CLI and logger styling
- •Colored README examples
- •Terminal theme design
How to Generate ANSI Color Codes
- Pick a color mode: Choose 16 colors for maximum compatibility, 256 colors for more variety, or truecolor for exact hex values.
- Select colors and styles: Click swatches or enter values for text and background, then toggle bold, italic, underline, and more.
- Check the live preview: The terminal-style preview shows exactly how your text will render with the current sequence.
- Copy and paste: Copy raw for direct terminal use, or the \x1b-escaped string for your source code, then wrap it in echo -e, printf, or print().
Key Features
- Three color modes: 16-color, 256-color, and 24-bit truecolor SGR sequences
- Live terminal-style preview for foreground, background, and text styles
- Style toggles: bold, dim, italic, underline, and strikethrough
- Copy raw (real ESC char) or \x1b-escaped sequences for any language
- Instant client-side generation - no install, no upload, works offline