Skip to main content
ansicode

ANSI escape decoder

Paste a string that contains ANSI escape codes (literal ESC bytes, or escaped forms like \x1b[, \033[, \e[). We tokenize it, show the rendered output, and explain every escape.

Input

Rendered output

Error: something went wrong on line 42

Breakdown

families in input:textSGR
SGRESC [ 1;31mbold + fg redfgB
text"Error:"fgB
SGRESC [ 0mSGR reset
text" "
SGRESC [ 33mfg yellowfg
text"something went wrong"fg
SGRESC [ 0mSGR reset
text"\non "
SGRESC [ 36;1mfg cyan + boldfgB
text"line 42"fgB
SGRESC [ 0mSGR reset

Common patterns you'll see in logs

Real-world escape-laden output you'll find in build logs, kubectl, git, and journalctl. Click "Try in decoder" on any pattern to drop the bytes into the textarea above and see the tokenized breakdown.

CI build log — error severity prefix

Red bold severity tag that most build runners (GitHub Actions, GitLab, CircleCI) emit on test failure or compiler error.

\x1b[1;31mERROR\x1b[0m  Test failed in src/login.test.ts:42
Try in decoder →

kubectl get pods — status colors

Bold green for Running, red for CrashLoopBackOff — the standard SGR palette kubectl writes to a TTY.

\x1b[1;32mRunning\x1b[0m           nginx-7f8b8c5d-x4k9j   1/1   2h\n\x1b[1;31mCrashLoopBackOff\x1b[0m  api-6c4d8e9-z7q2m      0/1   12m
Try in decoder →

git diff — additions, deletions, hunks

Green for additions, red for deletions, cyan for hunk headers — git's default colours emitted under --color=always or when stdout is a terminal.

\x1b[36m@@ -1,3 +1,4 @@\x1b[0m\n\x1b[32m+import { foo } from "./foo";\x1b[0m\n\x1b[31m-import { bar } from "./bar";\x1b[0m
Try in decoder →

journalctl — severity-coloured log lines

systemd's journalctl colours each line by syslog priority — bold red for ERROR, bold yellow for WARN, dim for DEBUG.

\x1b[1;31mERR\x1b[0m  systemd[1]: Failed to start nginx.service\n\x1b[1;33mWARN\x1b[0m sshd[1234]: invalid user admin from 192.0.2.1
Try in decoder →

Canonical pages for the escape sequences you'll hit most often in decoder input.

FAQ

What is an ANSI escape code?
A short byte sequence (almost always starting with ESC, 0x1b) that tells a terminal how to colour text, move the cursor, switch screen modes, or set the window title. ANSI escape codes appear in build logs, test output, kubectl output, git output, and basically every CLI that writes coloured text.
Why does my log file contain characters like \x1b[31m?
When a CLI writes coloured output to a file (instead of an actual terminal), the escape bytes are written literally. Most tools check isatty(stdout) and disable colours when piped — but tools invoked with --color=always (git, ls, tsc) bypass this and leave the raw bytes in the log file.
How do I strip ANSI escape codes from a string?
For SGR (colour / style) sequences the regex \x1b\[[0-9;]*m covers the common case. For full coverage including OSC, DCS, and cursor-control sequences, see the per-language recipes on our Strip ANSI codes page.