Remove ANSI escape codes
Remove ANSI escape codes. Runs entirely on your device, nothing is uploaded.
Runs on your device. The file is never uploaded.
Remove ANSI escape codes deletes colour and cursor sequences from captured terminal output and leaves every other byte in place. Two families match: CSI, an escape then a bracket, digits or semicolons and a letter, and OSC, an escape then a closing bracket and a payload. Carriage returns, backspaces and form feeds stay.
Questions
Which escape sequences does it strip?
Two families. CSI sequences, which is escape followed by an opening bracket, then digits, semicolons or question marks, then a letter; that covers colours, bold, cursor movement and screen clearing. And OSC sequences, which is escape followed by a closing bracket and a payload ending in BEL or in escape backslash; that covers terminal hyperlinks and window titles. Those two are what turns up in captured logs.
Why are there still strange characters in my log?
Because not every control code is an ANSI escape sequence. Carriage returns used by progress bars to redraw a line, backspace characters, form feeds and bare escape characters that do not start a CSI or OSC sequence all pass through untouched. So do the box-drawing and spinner characters that many CLI tools print, which are ordinary Unicode. Run Unicode inspector on the result to see exactly what is left.
Does it change any of my actual text?
No. Only the matched escape sequences are deleted; every other byte of the file is written back as it was, including line endings, indentation and trailing whitespace. It is a single regular expression replacement with an empty string, so what remains is the plain text a terminal would have shown you without the colour.
Are there any options?
None. The tool does one thing, and running it twice on the same input gives the same output both times. There is nothing to configure and nothing to get wrong, which is also why it is safe to put in front of other text tools in a batch.
Can I clean several log files in one go?
Yes. It is a per-file tool, so drop as many logs as you like and each one comes back as its own result with the same name. Everything runs in a Web Worker on your machine, so a log full of internal hostnames and stack traces never leaves the tab.