Whitespace Cleaner
Cleans up whitespace: collapses runs of spaces to one, strips leading and trailing spaces from lines, and removes empty lines. The fastest fix for text that arrived ragged from a PDF, a spreadsheet or an OCR pass.
How to use
- Paste the messy text.
- Apply the cleanups — collapse spaces, trim line edges, drop empty lines.
- Copy the cleaned result.
- If duplicate lines are also a problem, run the dedupe tool next.
When you actually need this
- Fixing PDF-copied text where line breaks and double spaces landed everywhere.
- Cleaning spreadsheet exports padded with stray spaces that break matching.
- Tidying OCR output before pasting it into a document.
- Normalising whitespace in a list before comparing or importing it.
Why invisible characters break things
Trailing spaces and inconsistent blank lines are invisible in most editors but real to software: "Kim " fails to match "Kim" in a lookup, a trailing space breaks an exact filter, and duplicated blank lines wreck formatting on paste. That is why cleaning whitespace fixes a surprising share of "why doesn't this match" problems. Note the scope: this tool normalises spacing but leaves the text's characters alone. One habit worth keeping — clean whitespace first, before deduplicating or comparing, since "a" and "a " count as different lines until you do.
Related tools
FAQ
How does Whitespace Cleaner count characters with spaces and emoji?
It reports both a count with spaces and one without, so you can match whichever rule your form uses. Emoji and other characters outside the basic range are counted as a single visible character rather than as the two code units JavaScript stores internally.
Does Whitespace Cleaner work for languages other than English?
Yes. Korean, Japanese, Chinese, Hindi, Arabic and accented European text are all handled correctly. Word counting splits on whitespace, so for Chinese and Japanese the character count is the more meaningful figure.
Is my text saved anywhere?
No. Everything runs in the page itself and nothing is transmitted or stored — you can paste a draft, a contract or private notes without it leaving your device.