Whitespace Remover
Clean extra spaces without rewriting the words.
About this tool
Collapse turns runs of spaces and tabs into one space. Trim removes spaces at the ends of lines.
Line breaks stay unless you also use the line-break tool.
How to use it
- Open this page and provide the input it asks for.
- Set the options that are visible, then use Clean whitespace.
- Read the result in the panel. Copy it or download it when a file is offered. The input stays in this browser.
Limitations
- Line breaks stay unless you also use the line-break tool.
Interior space runs, line breaks left alone
What is cleaned
Runs of ordinary spaces and tabs inside the text are collapsed or removed according to the control, so double spaces become a single space or disappear. Line breaks are not the target. A paragraph break stays a paragraph break. If you wanted one long line, use the line-break joiner. If you wanted only the edges of each row cleaned, use trim. This page is the interior of the lines.
Non-breaking and odd spaces
A character that looks like a space and is not the usual space can survive. Pastes from word processors include non-breaking spaces and narrow spaces. JavaScript’s whitespace class and a literal space character are not the same set. If a “double space” survives, it may not be two U+0020 characters. The letter-frequency or a code-point view can tell you. This page does not name the code points it skipped.
When collapsing changes meaning
Two spaces after a period are a style, not data, in ordinary prose. In a monospaced table made of spaces, those runs are the columns. Collapsing them destroys the alignment. Do not clean a space-aligned log or an ASCII table if you still need the columns. Code indentation at the start of a line is an edge, which trim would remove, and interior spaces in a string literal are data. Whitespace cleaning is for prose that picked up ragged spacing.
Columns made of spaces are a format
Logs, tabular ASCII, and indentation-sensitive text use runs of spaces as alignment. Cleaning them is a content change, not a cosmetic one. Prose almost never needs two spaces in a row except after a period in some style guides, and collapsing those is the usual goal. If you are unsure, clean a copy and diff the lines.
Privacy
Your input is processed in your browser and is not uploaded to UtilChain. File names, text, and results are not sent to analytics.

