Calculator
What the Whitespace Cleaner does
Whitespace Cleaner: calculates Characters removed and Output from Text, Collapse runs of spaces to one and Trim each line. Example: collapse runs of spaces to one Yes, trim each line Yes and collapse multiple blank lines to one Yes gives characters removed 19.
Point it at Text, Collapse runs of spaces to one, Trim each line and Collapse multiple blank lines to one and it returns Characters removed and Output. Results refresh instantly, so trying variations costs nothing but a moment.
Doing this by hand is tedious and error-prone once the text runs past a few lines. That is usually what brings people preparing copy for publishing here.
The page holds your values in memory and forgets them the moment you close it.
The sections that follow cover the fields, the method, and one full example computed from the defaults.
What do the Whitespace Cleaner fields mean?
The Whitespace Cleaner uses 7 inputs. Every field is populated on load; treat those numbers as a template rather than a suggestion.
| Field | What to enter | Default |
|---|---|---|
| Text | paste or type any amount of text | This text has odd spacing. Trailing spaces here. Tabs inside. Done. |
| Collapse runs of spaces to one | choose from Yes or No | Yes |
| Trim each line | choose from Yes or No | Yes |
| Collapse multiple blank lines to one | choose from Yes or No | Yes |
| Remove all blank lines | choose from Yes or No | No |
| Convert tabs to spaces | choose from Yes or No | Yes |
| Replace non-breaking and zero-width spaces | choose from Yes or No | Yes |
How does the Whitespace Cleaner work?
Each output is derived from the inputs above in a single pass; there is no hidden state carried between runs, so the same inputs always give the same calculation.
Values are checked first: an out-of-range or non-numeric entry names the offending field instead of returning nonsense.
Worked example
These are the values the Whitespace Cleaner loads by default, and the result it produces from them. This walkthrough uses the starting values, which means you can follow along without typing anything.
| Text | This text has odd spacing. Trailing spaces h… |
|---|---|
| Collapse runs of spaces to one | Yes |
| Trim each line | Yes |
| Collapse multiple blank lines to one | Yes |
| Remove all blank lines | No |
| Convert tabs to spaces | Yes |
| Replace non-breaking and zero-width spaces | Yes |
| Characters removed | 19 |
|---|---|
| Output | This text has odd spacing. Trailing spaces here. Tabs inside. Done. |
How to use it
- Paste your content into Text.
- Pick a value for Collapse runs of spaces to one: the options are Yes or No.
- Pick a value for Trim each line: the options are Yes or No.
- Pick a value for Collapse multiple blank lines to one: the options are Yes or No.
- Pick a value for Remove all blank lines: the options are Yes or No.
- Pick a value for Convert tabs to spaces: the options are Yes or No.
- Pick a value for Replace non-breaking and zero-width spaces: the options are Yes or No.
- Because it recalculates as you type, you can dial a value in rather than guessing and re-running.
- You get Characters removed and Output back.
- Share the link rather than a screenshot. It carries the values with it.
What this tool does not do
- Very large pastes are limited by your browser memory rather than a server quota.
- Word and character definitions vary between tools: this one counts whitespace-separated tokens.
- It assumes the values you give are already consistent with each other.
Frequently asked questions
You need Text, Collapse runs of spaces to one, Trim each line, Collapse multiple blank lines to one, Remove all blank lines, Convert tabs to spaces and Replace non-breaking and zero-width spaces. Each field is pre-filled with a sensible default, which means a single edit is enough to get a meaningful answer.
With the values loaded when the page opens, characters removed comes out as 19. Change a value and the number is recomputed on the spot.
No. The transformation happens locally and the text is discarded when you close the tab.
It is free to use, with no premium tier holding back the useful parts.
The calculation is exact for the method described above. Where a value is rounded for display, the underlying figure keeps full precision.