Remove control characters from text

Remove control characters from text by stripping every invisible ASCII control codepoint U+0000 to U+001F and U+007F (DEL), with the exception of tab, line feed, and carriage return. So bell, backspace, form feed, and other legacy control codes that sneak in from terminal output, copy-paste, or corrupted exports all disappear, but your line breaks and tabs stay intact. The transform runs in your browser. For invisible Unicode characters higher up, see remove zero-width.

Input
Line 1:1 LF cloud_done Saved locally
Result Remove Control Chars
0 lines 0 chars

How control-character removal works

The strip is a single regex: /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g. That matches every ASCII control code except tab (U+0009), line feed (U+000A), and carriage return (U+000D), plus the DEL character at U+007F. Each match is replaced with an empty string. Tabs and newlines are excluded because they are structurally meaningful in plain text; the rest of the control set is invisible noise from terminal escape sequences, BEL prompts, and old-style file formats.

Common offenders the pass catches: bell (U+0007, terminal beep), backspace (U+0008), vertical tab (U+000B), form feed (U+000C), escape (U+001B, the start of ANSI escape sequences), and DEL (U+007F). After this pass, the result is safe to feed into editors, JSON parsers, and other systems that may complain about stray control bytes.

Output is computed locally in your browser as one regex call. ANSI colour escape sequences (ESC [ 31 m and friends) start with U+001B but contain printable bytes after that. This pass strips the leading escape character; for full ANSI cleanup, follow with find and replace on the bracket sequences. For invisible Unicode characters above the ASCII range, use remove zero-width.

How to use remove control characters from text

  1. 1Paste text from a terminal, log file, or corrupted export into the input panel.
  2. 2Read the cleaned result on the right with control codes stripped.
  3. 3Confirm tabs and line breaks survived (visible in the input status bar).
  4. 4Click Copy to take the cleaned text.
  5. 5Run remove zero-width after if invisible Unicode also needs to go.

Keyboard shortcuts

Drive TextResult without touching the mouse.

Shortcut Action
Ctrl FOpen the find & replace panel inside the input Plus
Ctrl ZUndo the last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor Plus
EscClose find & replace, or exit fullscreen
Ctrl KOpen the command palette to jump to any tool Plus
Ctrl SSave current workflow draft Plus
Ctrl PRun a saved workflow Plus

What this tool actually does

Strips ASCII control codes except tab, LF, CR

The match is /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g. Every C0 control code goes except tab (U+0009), line feed (U+000A), and carriage return (U+000D), plus DEL (U+007F). Common targets: bell, backspace, vertical tab, form feed, escape.

Tabs and newlines preserved

Structural whitespace stays in place. Tab characters survive, so column-aligned text keeps its layout. LF and CRLF line endings pass through, so paragraphs are unaffected. The input status bar shows which line ending was detected.

ANSI escape sequences partly handled

The escape character U+001B that starts every ANSI sequence is stripped, but the bracket and parameter bytes that follow (e.g. [31m) are printable and pass through. For complete ANSI removal, follow with find and replace on the bracket pattern \[\d+m.

Printable text and Unicode left alone

Letters, digits, punctuation, accented characters, CJK, emoji, and all printable Unicode pass through. The pass only targets ASCII control codes, so high-Unicode invisible characters like zero-width joiners are not removed; use remove zero-width for those.

Single regex, no upload

Implemented as one String.replace call. Evaluated in your browser on every keystroke. Linear time on huge inputs. Nothing about the text leaves the page, and no log of the input is kept on our side.

Worked example

Bell (U+0007), backspace (U+0008), and DEL (U+007F) are stripped; the line break between the two rows survives.

Input
Hello world!
More text here.
Output
Hello world!
More text here.

Settings reference

Behaviour Effect on output
ASCII control codes U+0000 to U+0008 Stripped. Includes null, BEL, backspace.
Tab (U+0009) Pass through. Column alignment is preserved.
Line feed (U+000A) and CR (U+000D) Pass through. LF and CRLF line endings stay intact.
Vertical tab (U+000B), form feed (U+000C) Stripped. Rare in modern text but found in legacy data.
Escape (U+001B) and other C0 controls Stripped. ANSI escape leads vanish; printable parameter bytes survive (run find/replace for full ANSI strip).
DEL (U+007F) Stripped.
Printable text and Unicode Pass through. Use remove zero-width for invisible Unicode.

FAQ

Will it remove tabs and newlines?
No. Tab (U+0009), line feed (U+000A), and carriage return (U+000D) are intentionally excluded from the strip set because they are structurally meaningful in plain text. To remove tabs as well, use remove all whitespace with Tabs Only mode. To collapse line breaks, use remove line breaks.
Does it strip ANSI colour codes from terminal output?
Partly. The escape character U+001B that starts every ANSI sequence is removed, but the bracket and parameter bytes that follow (e.g. [31m) are printable and pass through. For complete cleanup, follow this pass with find and replace using the regex \[\d+m.
What about zero-width spaces and joiners?
Those are Unicode characters above U+007F, so this pass does not touch them. Use remove zero-width for that. Pair the two when cleaning up suspicious copy-pasted text that might contain both ASCII control codes and Unicode invisibles.
When would I see control characters in normal text?
When pasting from terminals (BEL or ESC sequences), copying from PDFs (form feed page breaks), exporting from older databases or spreadsheets (vertical tab as record separator), or after a lossy character encoding conversion. The pass cleans them in one go.
Is the input uploaded?
No. The pass is a single regex replacement evaluated in your browser. Nothing about the text leaves the page, no copy is logged on our servers, and the output panel updates without any network call.