Skip to content
100% local

ANSI color code generator

Wrap text in ANSI escape codes to color and style it in a terminal.

Input
Output

ANSI color code generator

Paste text and this tool wraps each line in ANSI escape sequences so it prints in color in a terminal. It is built for CLI authors, log formatting and shell scripts that want a green "OK", a red "FAIL" or a highlighted heading without hardcoding raw escape bytes by hand.

Pick a foreground and background color from the 16 basic terminal colors, the 256-color cube (an index from 0–255), or a 24-bit hex value for true color terminals. Add styles — bold, dim, italic, underline, blink, inverse or strikethrough — and they combine into a single SGR sequence. The escape notation option controls how the escape byte itself is written: raw \u001b for pasting straight into a file, \e for shell double-quoted strings, \033 for C or Python string literals, or a ready-to-run printf command. Turn on "Rotate a color per line" to cycle a small palette across the lines of a list or log, and "Show terminal preview" to append a plain-text description of how each line would render, since a text panel cannot draw real terminal colors itself.

Line endings are read the same whether they are CRLF or LF, and the reset sequence at the end of each line is optional — turn it off if you are building a run of colored segments that share one reset at the very end. Very large inputs are capped so the browser tab never freezes; if a paste would produce more than the limit, the tool reports that instead of hanging.

Everything runs locally in your browser — the text you paste is never uploaded anywhere. Copy the result, download it as a .txt file, or send the output back into the input to layer another option on top.

FAQ

What is an ANSI escape code?
A short sequence starting with the ESC byte that tells a terminal to change color or style instead of printing visible characters — this tool builds the SGR (color/style) family of those sequences.
Which notation should I use?
Use raw \u001b when writing straight to a file a terminal will read, \e inside a shell double-quoted or $'...' string, \033 inside a C or Python string literal, and the printf option when you want a command you can paste directly into a shell.
Why does the output look like plain text in the box?
Text panels do not interpret escape codes, so the raw bytes show as nothing or as odd characters here — paste the result into an actual terminal (or use printf) to see the color. Turn on "Show terminal preview" for a readable, plain-text summary of the styling.
What does "Rotate a color per line" do?
It ignores the foreground color option and instead cycles a fixed set of colors across your lines, one per line — useful for making a long list or log easy to scan at a glance.
Is my text uploaded anywhere?
No. The escape codes are generated entirely in your browser — your text never leaves your device.