Skip to content

ANSI Color Codes Generator

Build and copy raw SGR escape sequences and search the standard 8 plus bright 8 terminal color codes.

Privacy: your files never leave your device. All processing happens locally in your browser.

How to use

  1. 1.Enter terminal text and choose optional foreground, background, bold, and underline settings.
  2. 2.Generate the sequence and inspect the visible escaped representation and SGR parameters.
  3. 3.Copy the raw sequence only into a trusted terminal-aware context and test its reset behavior.

About ANSI Color Codes Generator

ANSI Color Codes Generator builds Select Graphic Rendition control sequences for terminal text and provides a searchable 16-color code reference. Enter text, choose an optional foreground and background, add bold or underline, and generate both a visible escaped representation and the raw control bytes. The Copy button copies the raw ESC sequence so it can be pasted into a suitable source string, terminal-aware tool, fixture, or debugging workflow.

A generated sequence begins with the escape byte, an opening bracket, semicolon-separated decimal SGR parameters, and m. The text follows, then ESC[0m resets graphic rendition. For example, bright red foreground with blue background, bold, and underline uses parameters 1;4;91;44. The visible output writes the escape byte as \x1b so the sequence can be reviewed without changing the appearance of the browser page.

The base foreground codes are 30 through 37 and backgrounds are 40 through 47 in black, red, green, yellow, blue, magenta, cyan, and white order. Common xterm-compatible bright extensions use foreground 90 through 97 and background 100 through 107. ECMA-48 defines SGR and the base rendition controls; xterm documentation cross-checks the widely implemented bright mappings. The table keeps every foreground and background code explicit.

Color names describe palette slots, not guaranteed RGB values. Terminal emulators, themes, user profiles, accessibility settings, multiplexers, remote environments, and applications can remap those slots. Bold may select increased intensity rather than a heavier font, and some older terminals use bold to access a bright palette. Underline shape and color also vary. The browser deliberately does not display a fake color preview that would imply one universal terminal palette.

Raw escape bytes are control data. Pasting them into a terminal command line, log, issue, chat, or source file may produce invisible behavior rather than readable characters. Logs containing untrusted control characters can hide text, forge visual lines, create misleading links, or disrupt terminal state. Sanitize untrusted data before printing it to an interactive terminal and provide a plain-text logging path where control sequences are removed or visibly escaped.

The generator supports three styles only: bold parameter 1, italic parameter 3 in logic compatibility, and underline parameter 4, although the current interface exposes bold and underline. Unsupported style and color numbers are rejected. A reset is appended whenever a prefix is created so later terminal output is less likely to inherit formatting. A reset is a guardrail, not proof that every consumer will interpret the stream identically.

All text, choices, generated bytes, search terms, and clipboard operations remain in the browser. Nothing is uploaded or executed in a shell. The page has no terminal emulator and cannot determine whether a destination supports ECMA-48, xterm extensions, Windows virtual terminal processing, NO_COLOR conventions, or redirected noninteractive output. Test the actual application and provide a way to disable color.

Eight external fixtures lock the base foreground and background pairs; tests also enforce 16 unique code rows, one bright filter result, and an exact multi-style raw and escaped sequence. For reliable use, generate the smallest necessary set of parameters, inspect the visible representation, copy only into a trusted context, reset formatting, and verify behavior in the real terminal themes and output modes your users run.

Methodology & sources

Stores 16 named terminal palette slots with unique foreground and background SGR codes, validates optional style and color parameters, emits one CSI m prefix plus ESC[0m reset, exposes a visibly escaped representation, and copies the exact raw control-byte string.

Frequently asked questions

Why does the color look different in another terminal?
SGR color numbers select palette slots. Terminal themes and user settings choose the actual RGB values, so this tool does not promise a fixed visual color.
What does Copy raw sequence place on the clipboard?
It copies the actual ESC control byte, SGR parameters, text, and reset, not the four visible characters backslash-x-1-b.
Are terminal escape sequences safe in logs?
Untrusted control bytes can make logs misleading or disrupt terminal state. Sanitize untrusted text and offer a plain or visibly escaped logging mode.

Developer Tools guides

View all