How whitespace removal works
The default mode All Whitespace uses the regex /\s+/g, which matches every Unicode whitespace character including ASCII space, tab, newline, carriage return, non-breaking space, em space, and the rest of the White_Space property. Each run of one or more whitespace characters is replaced by the value in the Replace With field, which defaults to an empty string for full removal.
Three narrower modes target one kind of whitespace at a time. Spaces Only matches only the ASCII space character. Tabs Only matches only the tab character. Newlines Only matches \n or \r\n. Each is implemented with a tighter regex, so non-target whitespace passes through. Useful when you want to flatten paragraphs but keep tabs aligned, or strip tabs without losing line breaks.
The fifth mode, Custom, takes any characters you type into the Custom field and matches them as a character class. Each character is regex-escaped so dots, brackets, and slashes work as literals. The Replace With field still applies, so you can swap your custom characters for a hyphen or any other string. Output is computed in your browser on every keystroke, no upload.
How to use remove all whitespace from text
- 1Paste text into the input panel on the left.
- 2Pick a Mode: All, Spaces Only, Tabs Only, Newlines Only, or Custom.
- 3For Custom, type the characters you want stripped into the Custom field.
- 4Optionally fill Replace With to substitute each match instead of deleting it.
- 5Click Copy to grab the cleaned text.
Keyboard shortcuts
Drive TextResult without touching the mouse.
| Shortcut | Action |
|---|---|
| Ctrl F | Open the find & replace panel inside the input Plus |
| Ctrl Z | Undo the last input change |
| Ctrl Shift Z | Redo |
| Ctrl Shift Enter | Toggle fullscreen focus on the editor Plus |
| Esc | Close find & replace, or exit fullscreen |
| Ctrl K | Open the command palette to jump to any tool Plus |
| Ctrl S | Save current workflow draft Plus |
| Ctrl P | Run a saved workflow Plus |
What this tool actually does
All-whitespace mode catches every kind
The default uses /\s+/g, which matches the full Unicode White_Space set: ASCII space, tab, line feed, carriage return, vertical tab, form feed, non-breaking space, em space, en space, and others. Each run collapses into the replacement string, default empty.
Narrow modes for targeted strips
Pick Spaces Only for ASCII space, Tabs Only for tab, or Newlines Only for \n or \r\n. Other whitespace passes through. Lets you flatten paragraphs without breaking column alignment, or remove tabs without joining lines.
Custom mode takes your own character set
Switch Mode to Custom and type any characters into the Custom field. Special regex characters are escaped automatically, so ., (, [, \, and others are matched literally. The match is greedy: a run of any characters in your set is treated as one match.
Replace With substitutes instead of deletes
The Replace With field is the second argument to the regex replacement. Empty (default) deletes the matched whitespace. A single space turns runs of mixed whitespace into single spaces. A hyphen joins words, useful for slug-style output.
Greedy match keeps the result tidy
Each regex uses the + quantifier, so consecutive whitespace characters collapse into a single match. With Replace With set to a single character, runs of 5 spaces and a tab become exactly one replacement character, not five.
Worked example
Mode: All Whitespace, Replace With empty. Every space, tab, and newline disappears in one pass.
hello world tab here
helloworldtabhere
Settings reference
| Setting or behaviour | Effect on output |
|---|---|
| Mode: All Whitespace (default) | Strips every Unicode whitespace character via /\s+/g. |
| Mode: Spaces Only | Strips only ASCII space. Tabs and newlines pass through. |
| Mode: Tabs Only | Strips only tab characters. |
| Mode: Newlines Only | Strips \n and \r\n. Spaces and tabs pass through. |
| Mode: Custom | Strips any characters listed in the Custom field. Regex specials are auto-escaped. |
| Custom field | Active only when Mode is Custom. Empty custom = no-op pass-through. |
| Replace With field | Substitutes each match. Default empty = full deletion. Single space = whitespace normalisation. |
| Letters, digits, punctuation, emoji | All pass through unchanged in every mode. |
FAQ
How do I just remove tabs without losing newlines?
What is the difference between this and remove extra spaces?
How does Custom mode handle special characters?
· and _, type both into the field. There is no need to quote or escape anything yourself.Can I replace whitespace with a hyphen for slugs?
-. Every run of whitespace becomes a single hyphen, producing slug-style output. For full slug generation including case folding, use slug generator.Does it touch non-breaking spaces?
\s class includes U+00A0 (non-breaking space), so they get stripped along with regular spaces. In Spaces Only mode, non-breaking spaces pass through, since that mode targets only the ASCII space character.