My Tools Garage

Whitespace Cleaner

Trim, collapse spaces and strip blank lines.

in-browser
Cleaned output

How to use

  1. 1 Paste the text you want to tidy.
  2. 2 Choose which whitespace rules to apply.
  3. 3 Watch the cleaned output update live.
  4. 4 Copy the result.

About Whitespace Cleaner

Whitespace Cleaner tidies up the invisible mess that creeps into text copied from PDFs, emails, code editors and spreadsheets.

Each option works independently: trim leading and trailing whitespace from every line, collapse runs of spaces and tabs within a line down to a single space, remove blank or whitespace-only lines, and convert tab characters to spaces.

Combine them to normalise a paragraph in one pass.

Stray double spaces, ragged indentation and rows of empty lines break diffs, throw off alignment and look careless in published copy.

Cleaning them by hand is fiddly, and find-and-replace only catches one pattern at a time.

This tool applies the rules you pick in a sensible order and shows the result live.

Everything happens in your browser, so even confidential documents stay on your machine.

Because the options are independent, you can keep just the cleanup you want — for instance trimming line ends without touching the spacing inside each line — which makes it safe to run on code, prose and data alike.

FAQ

Does collapsing spaces affect line breaks?

No — it only collapses spaces and tabs inside a line; your line breaks are preserved.

How many spaces does a tab become?

Tabs are converted to two spaces when that option is enabled.