Remove ANSI color codes from a log
Paste output from a terminal, a CI job or docker logs. Get plain text back, or see the colours the way the terminal showed them.
What the codes are
Terminals colour text with escape sequences: an invisible ESC character followed by something like [31m for red and [0m to reset. Saved to a file, they turn into clutter. Depending on what handled the log on the way, ESC shows up as nothing, as ^[, or spelled out as \u001b, \x1b or \033. This page removes all of those spellings, along with cursor movement and terminal title sequences.
To stop a program writing the codes in the first place, most tools honour the NO_COLOR environment variable or a --no-color flag. Remove or display ANSI codes in a log covers Docker, npm and other common sources.
FAQ
Is the text I paste sent anywhere?
No. The cleaning happens in your browser, so it is safe for logs with internal hostnames or tokens.
Can I strip codes on the command line instead?
Yes. sed 's/\x1b\[[0-9;]*m//g' file.log removes the common colour codes. The page also handles the escaped spellings and non-colour sequences, and is quicker for a one-off paste.
Which colours does the preview support?
The 16 standard colours, the 256-colour palette and 24-bit colour, plus bold, dim, italic and underline.
Reading coloured logs on a Mac?
Log Viewer shows ANSI colours as colour in files of any size, and filters, follows and compares them too.
FreemacOS