Four quick presets
| Preset | What it does | Example |
|---|---|---|
| Tidy spacing | Trims every line, collapses repeated spaces, and reduces runs of blank lines to one. | Paragraph breaks survive; stray spaces do not. |
| Remove extra spaces | Turns every run of spaces and tabs into one space and trims the start and end of the text. Line breaks stay where they are. | Hello····world → Hello world |
| Minify to one line (text minifier) | Collapses every run of spaces, tabs and line breaks into a single space. | A multi-line paragraph, address or SQL query becomes one compact line. |
| Remove all whitespace | Deletes every space, tab and line break. | a b↵c → abc |
After choosing a preset you can fine-tune any option; the result updates immediately and the line under the buttons shows how many spaces, tabs and line breaks were removed.
Why remove extra whitespace?
Text copied from PDFs, web pages, Word documents and emails often carries double spaces, trailing tabs, invisible non-breaking spaces and runs of blank lines. They are hard to see but they break things: a trailing space makes two “identical” strings compare as different, a non-breaking space (U+00A0) slips past a normal split(' '), and blank lines turn into empty rows when the text is imported into a spreadsheet or database. Cleaning the whitespace first saves chasing a bug that is really just formatting.
Minify text to a single line
The Minify to one line preset works like a text minifier: it replaces every run of whitespace — spaces, tabs, \n and \r\n line breaks — with one space and trims both ends. Use it to paste a paragraph into a single-line form field, a CSV cell or a JSON string, or to put a formatted SQL query on one line for a log or a config file. For code, prefer a language-aware minifier such as the HTML minifier, which also knows about comments and strings.
Whitespace characters handled
Space (U+0020), tab (\t), line feed (\n), carriage return (\r), and — with Normalise non-breaking & zero-width spaces on — the non-breaking space U+00A0, narrow and figure spaces, the ideographic space, and the invisible zero-width space U+200B, joiners and byte-order mark U+FEFF. Remove ALL whitespace uses JavaScript’s \s class, which already covers all of them.
Common questions
How do I remove extra spaces between words?
Choose Remove extra spaces. Every run of two or more spaces or tabs becomes a single space, and the start and end of the text are trimmed, while line breaks stay in place.
How do I remove all whitespace from text?
Choose Remove ALL whitespace. Every space, tab and line break is deleted, so a b on one line and c on the next becomes abc. The link ?mode=whitespace opens the tool with that option on.
How do I put multi-line text on one line?
Use Minify to one line. It replaces all line breaks and repeated spaces with a single space and trims both ends, turning a paragraph into one compact line.
Can I remove empty lines only, without touching spacing?
Yes. Set Trim spaces to Do not trim, untick Collapse multiple spaces, and tick Remove blank lines. Each option works independently.
How do I remove trailing spaces at the end of each line?
Set Trim spaces to Trailing spaces only. Indentation at the start of each line is kept, which is useful for code and Markdown.
Will this change the words in my text?
No. Only whitespace characters are affected; letters, numbers and punctuation stay exactly as they were.
Is my text uploaded?
No. The whitespace remover runs entirely in your browser.