← All Tools
Whitespace Cleaner🔒 100% local
Clean up code whitespace. Privacy-first, no server uploads, no tracking.
Related Tools
Whitespace Cleaner rewrites the spacing in pasted text: non-breaking spaces become ordinary spaces, zero-width and BOM characters are deleted, tabs become single spaces, runs of two or more spaces collapse to one, runs of blank lines shrink to a single empty line, and every line is trimmed at both ends. Before showing the result it prints how many characters were removed and a breakdown by category. The rewriting happens on the string in the page.
How to use it
- Paste the text or code you want to tidy.
- Press Process.
- Check the Removed breakdown, then copy the Result section back into your editor.
Worked example
Hello World
second line becomesCleaned 10 chars of whitespace (34 → 24).
Removed:
3 leading/trailing
4 runs of multiple spaces
1 tabs
1 extra blank lines
0 non-breaking spaces
0 zero-width/BOM chars
Result:
Hello World
second lineThe categories overlap: the spaces at the end of the first line are counted both as leading/trailing and as a run of multiple spaces.
When to use it
- Cleaning text copied out of a PDF, a spreadsheet cell or a web page before using it as data.
- Removing the non-breaking spaces that make pasted content look right but break string comparison.
- Tidying a log excerpt or a one-line JSON blob before sharing it.
What it does not do
- Line indentation is stripped, so this breaks Python, YAML, Makefiles and anything where leading spaces carry meaning.
- The Removed categories are separate matches rather than a partition, so they do not add up to the character total printed on the first line.
- Two or more newlines always collapse to exactly one empty line; there is no way to merge paragraphs down to zero blank lines.
- Collapsing runs of spaces also rewrites spaces inside quoted strings, which can change the value you were cleaning.