Free ANSI Escape Code Viewer
Paste colourful terminal output or a string full of escape codes to see it rendered, cleaned to plain text, or decoded code by code.
What is an ANSI Escape Code Viewer?
ANSI escape codes are the invisible sequences that make terminal text red, bold or underlined. When terminal output lands in a log file or a CI page, they show up as clutter like [31m. This viewer renders them as colours again, strips them to plain text, or explains each one.
It follows the SGR codes of ECMA-48, the standard terminals implement, plus xterm’s 256-colour and 24-bit truecolor extensions. Cursor moves and line clears are removed, and OSC 8 hyperlinks keep their text. The escape character can be pasted raw or typed as \e, \x1b, \033, \u001b or ^[.
Key Features
Colours as the Terminal Showed Them
Preview draws the text on a dark background using xterm’s default palette, so test results, warnings and diffs look the way they did in the terminal.
Clean Plain Text
Plain text removes every escape sequence, leaving output you can paste into a ticket, email or search box.
Each Code Decoded
Codes mode lists every style sequence with what it does, from 1 for bold to 38;5;208 for orange, which helps when writing your own.
Typed Escapes Understood
Strings copied from scripts, such as echo -e or printf commands, are read with their typed escapes, line breaks and tabs.
Logs Stay Local
Output is processed in your browser and nothing is uploaded, which matters when logs contain internal hosts or tokens.
Perfect for everyone
- Developers reading CI logs
- DevOps engineers cleaning up captured output
- Anyone writing coloured command-line output
How to Use the ANSI Escape Code Viewer
Paste the output, then switch between rendered, plain and decoded views.
Paste Terminal Output
Copy from a log file, CI job or terminal session. Typed strings such as \e[1;31mERROR\e[0m from scripts work too.
Preview the Colours
Preview shows the text with colours, bold, underline and strikethrough applied, on a terminal-style background.
Strip to Plain Text
Plain text removes every escape code. Copy or download it for documentation, tickets or diffing.
Decode the Codes
Codes lists each style sequence with its effect, and counts cursor and clear sequences that were removed.
Escape Codes, Rendered and Decoded
Each input below uses typed escapes like \e for readability. The answer is the exact output this viewer gave in the chip’s mode, HTML included for Preview rows.
“\e[1;31mERROR\e[0m disk full”
“\e[1;31mERROR\e[0m disk full”
“\e[1;31mERROR\e[0m disk full”
“\e[32m✓\e[0m 12 passed, \e[31m✗\e[0m 1 failed”
“\e[38;5;208morange\e[0m”
“\e[48;2;0;95;135m teal \e[0m”
“\e[2K\rDownloading 45%”
“\e[4munderlined\e[24m and \e[9mstruck\e[29m”
“<b>not bold</b> \e[1mbold\e[0m”
“no escape codes here”
The Escape Codes You’ll See Most
Style codes are written ESC, a bracket, numbers separated by semicolons, then m. These ten cover nearly all coloured output.
Reset
Code 0 clears every colour and style. Programs end coloured text with it so the colour doesn’t leak into the next line.
“Which code resets everything?”
Bold and Dim
1 makes text bold, often also brighter, and 2 makes it dim. Code 22 turns both off.
“Which code turns bold off?”
Standard Colours, 30 to 37
30 to 37 set the text colour: black, red, green, yellow, blue, magenta, cyan and white. 39 restores the default.
“Which code is green text?”
Backgrounds, 40 to 47
The same eight colours as backgrounds, from 40 to 47. 49 restores the default background.
“Which code is a red background?”
Bright Colours, 90 to 97
Bright versions of the eight colours, with 100 to 107 for bright backgrounds. They come from aixterm and are supported almost everywhere.
“Which code is bright cyan text?”
256 Colours
38;5;n picks colour n from a 256-colour palette: 16 system colours, a 6 by 6 by 6 cube and 24 greys. 48;5;n does the same for backgrounds.
“How do you write palette colour 208 as text colour?”
Truecolor
38;2;r;g;b sets any 24-bit colour, and 48;2;r;g;b sets the background. Most modern terminals support it.
“How do you write pure orange text in truecolor?”
Underline, Italic and Strikethrough
4 underlines, 3 sets italic and 9 strikes through. 24, 23 and 29 turn them off again.
“Which code underlines?”
Inverse
7 swaps the text and background colours, which tools use for highlighted selections and status bars. 27 turns it off.
“Which code swaps colours?”
Codes Combine
Several codes can share one sequence, separated by semicolons. 1;31 is bold red in a single escape.
“How do you write bold yellow text?”
Writing Escape Codes in Your Language
Every language has its own way to write the escape character. These eight produce bold red text followed by a reset.
Bash With echo
echo needs the -e flag before it reads backslash escapes, and \e is a bash extension. Without -e, the codes print literally.
“How does echo print bold red?”
POSIX printf
printf understands octal escapes in every shell, so \033 is the portable choice for scripts.
“How does printf print bold red?”
Python
Python strings accept \033 or \x1b. Libraries such as colorama or rich also handle Windows consoles.
“How does Python print bold red?”
JavaScript and Node.js
Use \x1b or \u001b in strings. Node’s util.styleText and packages such as chalk generate the codes for you.
“How does Node print bold red?”
Go
Go string literals take \x1b or \033. Wrap codes in constants so they’re easy to disable when output isn’t a terminal.
“How does Go print bold red?”
Rust
Rust supports \x1b in strings. Crates like owo-colors or anstream add colour and strip it when output is piped.
“How does Rust print bold red?”
C and C++
Both accept the octal \033 and the hex \x1b escape in string literals, passed to printf or std::cout.
“How does C print bold red?”
PowerShell
PowerShell 7 writes the escape character as backtick e inside double quotes, and also offers the PSStyle variable for named styles.
“How does PowerShell 7 print bold red?”
Sequences That Aren’t Colours
Terminal output contains more than styles. These are removed from the preview and the plain text.
Cursor Movement
Sequences ending in A, B, C or D move the cursor up, down, right or left. Progress bars and spinners use them to redraw.
Erase Line and Screen
ESC[2K clears a line and ESC[2J the whole screen. In a log file they’re just clutter.
Carriage Returns
A bare carriage return sends the cursor back to the start of the line, so the next text overwrites it. Downloads and progress meters rely on it.
Hyperlinks, OSC 8
Modern terminals support clickable links written as ESC ] 8 sequences around the link text. The viewer keeps the text and drops the wrapper.
Window Titles
ESC ] 0 sequences set the terminal window title. Shell prompts often send them on every command.
Bracketed Paste and Modes
Sequences ending in h or l switch terminal modes, such as bracketed paste. They’re invisible and removed.
Coloured Output Mistakes
Most problems with escape codes come from writing them into places that can’t display them.
Colours in Log Files
Codes written to files or log collectors appear as [31m clutter. Disable colour when output isn’t a terminal.
Forgetting to Reset
Text after a missing ESC[0m stays coloured, sometimes for the rest of the session. Always end coloured output with a reset.
Ignoring NO_COLOR
The NO_COLOR environment variable asks programs not to emit colour. Respect it, along with a --no-color flag.
Assuming Truecolor Everywhere
Older terminals and some CI viewers support only 16 or 256 colours. Fall back gracefully or stick to the basic eight.
Colour as the Only Signal
Red and green are hard to tell apart for many readers. Pair colour with a symbol or word, like a cross and FAIL.
Escaping the Escape
In shells, echo needs -e to read \e, while printf reads \033 directly. In JSON and JavaScript strings, write \u001b.
Measuring Coloured Strings
Escape codes count as characters, so padding coloured text with string length breaks alignment. Strip codes before measuring.
Theme-Dependent Colours
Terminals remap the 16 basic colours to their own theme, so yellow can be unreadable on a light background. Test both themes.
When an ANSI Viewer Helps
Whenever terminal output ends up somewhere that isn’t a terminal.
Reading CI Logs
Paste a raw CI log to see test failures in red again, instead of hunting through escape codes.
Cleaning Output for a Ticket
Strip codes from a command’s output before pasting it into a bug report or chat message.
Building a CLI
Check that your tool’s coloured output looks right and resets properly before shipping.
Debugging a Prompt
Decode the escape codes in a shell prompt string to see which one sets the unexpected colour.
Documenting Terminal Output
Preview coloured output to screenshot it for documentation, or strip it for code blocks.
Inspecting Captured Logs
Logs collected from containers often keep colour codes. Render them to scan errors quickly.
Learning Escape Codes
Type codes by hand and watch the colours and decoded meanings update together.