Whitespace Cleaner

Trim, collapse, normalize whitespace and line endings

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 normalises all of it: collapses runs of whitespace into single spaces, 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.

Examples

Trim and collapse
Input
  hello   world  


  goodbye   
Output
hello world
goodbye

Frequently asked questions

What counts as 'whitespace'?

All Unicode whitespace: space, tab, non-breaking space (\u00A0), zero-width space (\u200B), and the various Unicode space variants. They all get normalised to a regular space.

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.