Whitespace Cleaner
Trim, collapse, normalize whitespace and line endings
When do you need whitespace cleanup?
Pasted text from PDFs, slide decks, OCR output, or rich editors is often littered with non-breaking spaces, double-tabs, trailing whitespace, and mysterious blank lines. The cleaner tidies the common cases: collapses runs of regular spaces and tabs into a single space, trims each line, and optionally strips empty lines.
Useful before piping text into a CSV, before counting words for a strict word-limit submission, or before pasting code that won't compile because of stray invisible characters.
Use cases
- Clean pasted code — strip trailing spaces and collapse tabs after copying from Stack Overflow or Slack.
- Normalise CSVs — remove leading/trailing whitespace in pasted fields before importing.
- Tidy markdown — collapse stray double-spaces and trim trailing whitespace before publishing a post.
- Strip invisible garbage — clean up text copied from PDF / Word that brings hidden Unicode along.
Examples
hello world
goodbye hello world
goodbyeFrequently asked questions
What counts as 'whitespace'?
Runs of regular spaces and tabs are collapsed to one, and each line is trimmed (which also drops leading and trailing non-breaking spaces). It does not strip zero-width characters or collapse non-breaking spaces in the middle of a line.
Are blank lines always removed?
Only if you enable that option. By default, blank-line stripping is opt-in so you don't accidentally lose paragraph breaks.
Does it touch leading whitespace inside code?
Yes — be careful with indented code (Python, YAML). Cleaning whitespace will collapse indentation. Use a code formatter instead for those.
Is non-Latin text affected?
No — only whitespace characters are modified. CJK ideographs, emoji, and accented characters pass through unchanged.
Does the tool upload my text?
No. Cleaning runs in your browser; nothing is sent to a server.
