How to use Whitespace Cleaner
What it does & when you need it
Text you copy from a PDF, an email, a spreadsheet, or a chat window arrives full of invisible mess: double spaces, stray tabs, trailing whitespace, blank lines between every paragraph, and non-breaking spaces that look ordinary but behave differently. This tool cleans all of that up in one pass. You choose which rules to apply — collapse runs of spaces, trim each line, drop blank lines, expand tabs, strip the document's leading and trailing whitespace, or remove every whitespace character entirely — and the result updates as you type.
It runs entirely in your browser, so pasted contracts, log excerpts, or private notes never leave your machine. Reach for it before committing a config file, tidying data copied out of a table, or normalising a block of prose so a diff shows only the changes that matter.
How to use
- Paste your text into the input buffer, press Sample to load a messy
example, or Upload a
.txt,.md, or.logfile. - Toggle the rules you want: Collapse spaces, Trim lines, Remove blank lines, Trim ends, a Tabs conversion width, or Strip all to remove every whitespace character.
- Read the result in the cleaned buffer — the status bar shows how many
characters were removed. Press Copy result or
Ctrl/Cmd+Enterto grab it.
Things worth knowing
Collapsing handles Unicode spaces, not just the ordinary one. A non-breaking
space (U+00A0), the narrow no-break space, and the en and em spaces all look
like a normal gap but are different code points, and they routinely sneak in from
word processors and web pages. The collapse rule folds any run of horizontal
whitespace — including those — down to a single ordinary space, while leaving your
line breaks alone.
Order is deliberate. Tabs are expanded first, then spaces are collapsed, then lines are trimmed and blank lines removed, and finally the whole document is trimmed. That sequence means a line of only spaces becomes genuinely empty and is caught by blank-line removal. Strip all overrides everything, deleting every space, tab, and newline at once.
Once the text is clean you might count what is left, sort the lines, or diff two versions.