— Developer Tools

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.

— Samples
Style codes 16Other codes removed 0Valid
Live

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.

1

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.

2

Preview the Colours

Preview shows the text with colours, bold, underline and strikethrough applied, on a terminal-style background.

3

Strip to Plain Text

Plain text removes every escape code. Copy or download it for documentation, tickets or diffing.

4

Decode the Codes

Codes lists each style sequence with its effect, and counts cursor and clear sequences that were removed.

Worked Examples

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.

REF_001Preview, bold red

“\e[1;31mERROR\e[0m disk full”

REF_002Plain text

“\e[1;31mERROR\e[0m disk full”

REF_003Codes

“\e[1;31mERROR\e[0m disk full”

REF_004Preview, test summary

“\e[32m✓\e[0m 12 passed, \e[31m✗\e[0m 1 failed”

REF_005Codes, 256 colours

“\e[38;5;208morange\e[0m”

REF_006Codes, truecolor

“\e[48;2;0;95;135m teal \e[0m”

REF_007Plain, progress line

“\e[2K\rDownloading 45%”

REF_008Preview, decorations

“\e[4munderlined\e[24m and \e[9mstruck\e[29m”

REF_009Preview, HTML escaped

“<b>not bold</b> \e[1mbold\e[0m”

REF_010No escapes

“no escape codes here”

SGR Codes

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.

01 / RESET

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?”

02 / BOLD

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?”

03 / STANDARD

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?”

04 / BACKGROUNDS

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?”

05 / BRIGHT

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?”

06 / 256

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?”

07 / TRUECOLOR

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?”

08 / UNDERLINE

Underline, Italic and Strikethrough

4 underlines, 3 sets italic and 9 strikes through. 24, 23 and 29 turn them off again.

“Which code underlines?”

09 / INVERSE

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?”

10 / CODES

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?”

In Code

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.

01 / BASH

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?”

02 / POSIX

POSIX printf

printf understands octal escapes in every shell, so \033 is the portable choice for scripts.

“How does printf print bold red?”

03 / PYTHON

Python

Python strings accept \033 or \x1b. Libraries such as colorama or rich also handle Windows consoles.

“How does Python print bold red?”

04 / JAVASCRIPT

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?”

05 / GO

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?”

06 / RUST

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?”

07 / C

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?”

08 / POWERSHELL

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.

Tip 01

Colours in Log Files

Codes written to files or log collectors appear as [31m clutter. Disable colour when output isn’t a terminal.

Tip 02

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.

Tip 03

Ignoring NO_COLOR

The NO_COLOR environment variable asks programs not to emit colour. Respect it, along with a --no-color flag.

Tip 04

Assuming Truecolor Everywhere

Older terminals and some CI viewers support only 16 or 256 colours. Fall back gracefully or stick to the basic eight.

Tip 05

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.

Tip 06

Escaping the Escape

In shells, echo needs -e to read \e, while printf reads \033 directly. In JSON and JavaScript strings, write \u001b.

Tip 07

Measuring Coloured Strings

Escape codes count as characters, so padding coloured text with string length breaks alignment. Strip codes before measuring.

Tip 08

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.

Frequently Asked Questions