How extra-space removal works
The cleaner walks the input with a regular expression that matches two or more consecutive ASCII spaces, then writes back exactly the number of spaces you asked for. The default cap is one, so any run of 2, 5, or 50 spaces collapses to a single space. Tabs (\t) and other whitespace characters are not touched, so a tab between columns survives the pass even when nearby double-spaces are squeezed.
Newline collapsing is a separate, opt-in pass. Toggle Newlines on and any run of \n or \r\n longer than the Max Newlines value collapses to that many line breaks. Leave it off and your blank lines pass through untouched, which is what you want when blank lines carry meaning (paragraph breaks in prose, separators in logs).
Everything runs in the browser via JavaScript. No upload, no log, no round trip. The output panel updates as you type, and the input status bar shows the line ending so you can confirm CRLF stayed CRLF after the transform. For stripping every space rather than collapsing runs, switch to remove all whitespace; for trimming only the ends of each line, see trim whitespace.
How to use remove extra spaces from text
- 1Paste or type your text into the input panel on the left.
- 2Confirm the Spaces toggle is on and read the live result on the right.
- 3Adjust Max Spaces if you want to keep up to 2 or 3 spaces between words.
- 4Turn on Newlines and set Max Newlines to cap consecutive blank lines.
- 5Click Copy in the output header 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
Collapses runs of spaces, not all whitespace
The regular expression / {2,}/g only matches the ASCII space character. Tabs, non-breaking spaces, em spaces, and other Unicode whitespace pass through untouched. If you want every kind of whitespace gone, use remove all whitespace instead.
Configurable cap on space runs
The Max Spaces field accepts 1 to 20. A value of 1 turns every run into a single space, the standard typographic outcome. A value of 2 lets double-spaces survive, useful for fixed-width tables where double-space is a column separator.
Optional blank-line collapsing
Flip the Newlines toggle on to collapse runs of line breaks. The match handles both \n and \r\n, and the Max Newlines field caps how many survive. Leave the toggle off and paragraph breaks pass through as-is.
Tabs and other whitespace preserved
Tab characters are skipped by the space regex, so columns indented with tabs stay aligned. To convert tabs to spaces first, run tabs to spaces before this tool, or to go the other way use spaces to tabs.
Runs in your browser, no upload
The transform is a single String.replace call evaluated locally on every keystroke. Nothing leaves the page, no copy of your text is logged, and the output panel updates without a server round trip.
Worked example
Default settings collapse space runs to one. The four blank rows pass through because Newlines is off.
The quick brown fox jumps over the lazy dog. Final line
The quick brown fox jumps over the lazy dog. Final line
Settings reference
| Setting or behaviour | Effect on output |
|---|---|
| Spaces toggle (default on) | When on, runs of 2+ ASCII spaces collapse. Turn off to bypass space collapsing entirely. |
| Max Spaces (default 1) | Caps how many consecutive spaces survive. 1 leaves single spaces, 2 keeps double-spacing, up to 20. |
| Newlines toggle (default off) | When on, runs of line breaks collapse. When off, blank lines pass through unchanged. |
| Max Newlines (default 1) | Caps consecutive line breaks when the newlines toggle is on. 1 removes all blank rows, 2 keeps single blank rows. |
| Tabs | Always pass through. Use tabs to spaces if you want them converted first. |
| Non-breaking and exotic whitespace | Pass through. Use remove all whitespace for full Unicode whitespace stripping. |
| Line endings | LF stays LF, CRLF stays CRLF. The input status bar shows which is in play. |