What does this tool do?
This tool finds and removes unwanted whitespace from text: extra spaces between words, tabs, leading and trailing spaces on each line, and blank lines. Before cleaning anything, it shows you a visualizer where every space, tab and line break is made visible, so you can see exactly what's hiding in text that looks fine at a glance. Everything runs as JavaScript inside your browser — there's no upload and no server round-trip, so your text never leaves your device.
Why hidden whitespace causes problems
Extra spaces are invisible in normal reading but can break things: double spaces after periods can trip up automated formatting, trailing whitespace can cause diffs in version control to look messier than they are, and inconsistent line spacing can make plain-text or Markdown output render unpredictably. Because whitespace doesn't show up visually in a normal text box, it's easy to paste in dozens of extra spaces without noticing.
How the cleanup options work together
Each option is independent, so you can combine them however you need. "Collapse multiple spaces" only affects runs of two or more spaces; "Trim start/end of each line" removes whitespace at the edges of every line without touching spacing in the middle; "Remove blank lines" deletes empty lines entirely; and "Trim whole text" only affects the very start and end of the full input, not anything in between.
Common sources of extra whitespace
- Copying from PDFs — PDF text extraction often inserts irregular spacing and line breaks.
- Pasting from Word or Google Docs — formatted documents can carry over invisible spacing artifacts.
- Old typing habits — double-spacing after a period was standard with typewriters and persists in some writing.
- Code and data exports — CSV exports and scraped data often contain inconsistent indentation and stray tabs.
- Chat and email threads — quoted replies can accumulate extra blank lines with each forward.
What each option removes
| Option | Example before | Example after |
|---|---|---|
| Collapse multiple spaces | hello world | hello world |
| Trim start/end of each line | hello world | hello world |
| Convert tabs to spaces | hello[TAB]world | hello world |
| Remove blank lines | line one\n\nline two | line one\nline two |
| Trim whole text | \n\nhello world\n\n | hello world |