Whitespace Cleaner
Trim lines, collapse repeated spaces and tabs, remove blank lines, join text into one line or replace non-breaking spaces. Every option can be combined.
About Whitespace Cleaner
The Whitespace Cleaner tidies text full of stray spaces, tabs and blank lines, the mess you get when copying from PDFs, emails and web pages.
Options you can combine
Trim each line, collapse repeated spaces and tabs, remove blank lines, join everything into one line, and replace non-breaking spaces.
The usual fix
For email or forum text, turn on trim, collapse, remove blank lines and replace non-breaking spaces together.
Hidden non-breaking spaces
They look like normal spaces but break searches, imports and word counts. Replacing them fixes many strange problems.
Good for
Cleaning text before pasting into a CMS, preparing lists for import, and fixing indentation noise.
Good to know
Spaces inside words and all other characters are left as they are.
Private
Your text stays in your browser. Nothing is uploaded.
Spaces vs whitespace
A space is one character. Whitespace also includes tabs, line breaks and special spaces such as the non-breaking space.
How to use Whitespace Cleaner
- Paste the messy text into the Input box, or press Open .txt file.
- Tick the options you need: Trim each line, Collapse repeated spaces/tabs, Remove blank lines, Join into one line, Replace non-breaking spaces.
- Check the Result box; it updates as you change an option.
- Press Copy, or Download .txt to save the cleaned text.
Help & FAQ
How do we fix text copied from a PDF with broken lines?
Tick Join into one line together with Trim, Collapse and Replace non-breaking spaces. In our test that gave one clean line.
Which options are on by default?
Trim each line, Collapse repeated spaces/tabs and Replace non-breaking spaces. Remove blank lines and Join into one line are off.
What is a non-breaking space and why replace it?
It is the character U+00A0. It looks like a space but some tools do not treat it as one, so it can break searches, sorting and imports.
Why did blank lines remain after cleaning?
Remove blank lines is off by default. Tick it to delete the empty lines.
Does Collapse also trim the line?
No. A run of spaces becomes one space, so a line that began with several spaces begins with one. Tick Trim each line as well.
Does Join keep paragraphs?
No. It puts all the text on one line, paragraphs included.
Will it remove spaces inside words?
No. Only runs of spaces and tabs between words, and spaces around lines, are changed.
Does it remove zero-width spaces?
No. The Unicode Inspector can show you if the text contains them.
Can we undo a change?
Untick the option and the result returns to what the other options give. With all options off, the text is unchanged.
Can we clean a file?
Press Open .txt file to load a plain text file, and Download .txt to save the result.
Is our text uploaded?
No. The cleaning runs in your browser.