Whitespace Cleaner

Collapse repeated spaces, trim line ends and remove empty lines left behind by copy and paste.

Processed on your device — no upload

termiva clean --trim --collapse
0 chars · 0 words
0 chars · 0 words
chars in 0chars out 0saved 0nothing uploaded

How to use it

  1. Paste the messy text.
  2. Choose how strict to be about spaces and blank lines.
  3. Copy the cleaned result — the counter shows how much was removed.

How it works

Four separate operations run in a fixed order, because the order changes the result. Tabs are expanded first, then runs of spaces are collapsed, then line ends are trimmed, then blank lines are handled. Trimming before collapsing would leave doubled spaces in the middle of lines; doing it this way does not.

Trailing whitespace is the invisible one. A space at the end of a line shows nothing on screen but makes two identical-looking lines different to every tool that compares them — deduplication, sorting, diffing, spreadsheet lookups. It is the most common cause of “these are the same, why does it say they are not”.

Blank lines have three settings rather than a switch, because the right answer differs. At most one in a row is what you want for prose, where paragraph breaks are meaningful but the four blank lines a PDF paste left behind are not. Remove all is for lists, where any blank line is noise.

The whole text is trimmed at the end, so leading and trailing blank lines around the block disappear too. Everything runs in your browser as you type.

A worked example

You paste a customer list out of an emailed PDF. It looks like a list. It behaves like a minefield:

   Ahmad Nasser


  Sara Haddad
Omar   Khalil


Leading spaces on some lines, trailing spaces on others, a doubled space inside a name, and blank lines scattered through. The character counter reads 74.

With trim line ends on, collapse repeated spaces on and blank lines set to remove all, you get three clean lines and the counter reads 42 — a third of the content was invisible whitespace.

The important part is what this unblocks. Run that original list through deduplication and Sara Haddad with a trailing space will not match Sara Haddad without one. Sort it and the leading-space lines gather at the top, away from the rest. Clean first, then everything else works.

For prose rather than lists, set blank lines to at most one in a row instead — that keeps paragraph structure while removing the gaps a PDF paste inserts.

Questions

How do I tidy the spacing in messy text?

It collapses runs of spaces, strips trailing whitespace and normalises blank lines, which is the format most editors and forms expect.

Why does trailing whitespace matter if I cannot see it?

Because every tool that compares text can see it. A trailing space makes two identical-looking lines different when deduplicating, sorting, diffing or looking up in a spreadsheet.

Is my text uploaded?

No. The cleaning runs in your browser as you type, and this site has no backend.

Will it destroy my paragraph breaks?

Not with the default setting, which allows at most one blank line in a row. Choose "remove all" only for lists where blank lines carry no meaning.

Does it touch spaces inside my text?

Only runs of two or more, which are collapsed to one. Single spaces between words are never changed.

What happens to tabs?

They are left alone by default. Switch the tabs option to convert each to two spaces, which is useful when pasting into a system that renders tabs unpredictably.

Does it handle Windows line endings?

Yes. Carriage returns are normalised first, so text from any operating system behaves the same.

Will it remove indentation from my code?

Yes, if you trim line ends — that also strips leading whitespace. Do not run source code through this tool with trimming on.

What does the "saved" figure count?

The difference in characters between what you pasted and what came out. On text copied from a PDF it is often a surprisingly large share of the total.