Toolverse

Whitespace Cleaner

Tidy up messy text — trim each line, collapse repeated spaces and tabs, and drop blank lines, with a before/after character count.

48 before33 after

How to use it

Paste or type your text into the input box on the left and turn on the cleanups you want. There is no button to press — the tidied result appears on the right and updates on every keystroke, and a live before/after character count shows how much was removed. When it looks right, use the copy button to place the cleaned text on your clipboard. Everything runs in your browser, so nothing is uploaded. Four independent options control what gets cleaned. Trim each line removes leading and trailing spaces and tabs from every individual line, so indentation and stray trailing spaces disappear while the words stay put. Collapse spaces replaces any run of spaces or tabs inside a line with a single space, turning "a b" into "a b" — useful for text pasted from PDFs or aligned columns. Remove blank lines drops any line that is empty or contains only whitespace, closing up the gaps left by double-spaced pastes. Trim whole result trims whitespace from the very start and end of the entire output after the other steps run. The order of operations is fixed and predictable. Collapsing and per-line trimming are applied to each line first, then blank lines are removed, and finally the whole result is trimmed if you asked for it. Because the steps are independent toggles, you can combine them freely — for example, collapse spaces without removing blank lines, or remove blank lines while leaving indentation intact. As a worked example, paste three lines where the first is " hello world ", the second is entirely spaces, and the third is "foo". With trim each line and collapse spaces on, the first line becomes "hello world"; add remove blank lines and the empty middle line disappears, leaving just "hello world" and "foo". The before/after counter makes the size reduction obvious at a glance. Cleaning whitespace is a common step before pasting text into a spreadsheet, diffing two files, committing code, or publishing copy that was assembled from several sources. Because the work happens entirely on your device, it is also safe for text you would rather not send to a remote service. If you also need to remove duplicate lines or sort them, run the cleaned output through the Remove Duplicate Lines or Line Sorter tools.

Frequently asked questions

What does 'collapse spaces' do?
It replaces any run of spaces or tabs inside a line with a single space, so 'a b' becomes 'a b'. Line breaks are kept.
Will it change my line breaks?
Only if you enable 'Remove blank lines', which drops empty lines. Other options affect spaces and tabs within and around lines, not the number of newlines.
Is my text uploaded?
No. All cleaning happens in your browser; your text is never sent to a server.
In what order are the cleanups applied?
Per-line steps run first — collapse spaces and trim each line — then blank lines are removed, and finally the whole result is trimmed if that option is on. The toggles are independent, so you can enable any combination.