How to use
The options are split into two groups, “Lines” and “Spaces”, and you can turn on as many as you need. Three common ones are already on when you open the page.
- Trim each line
- Collapse multiple spaces into one
- Convert non-breaking and full-width spaces to ordinary spaces
So pasting text into “Input” is enough to get a tidier copy in “Output”, with the whitespace at the edges of each line gone and doubled spaces between words reduced to one. Line breaks, empty lines and tabs are left alone in this starting state.
The options by example
Take these three lines. Invisible characters are written as · (space) and → (tab). The second line is empty.
··aa···bb··
→cc·dd→
| Options on | Result |
|---|---|
| Starting state (three options) | Three lines: aa·bb, an empty line, cc·dd |
| Starting state + Remove empty lines | Two lines: aa·bb, cc·dd |
| Starting state + Remove empty lines + Remove line breaks (Join with a space) | One line: aa·bb·cc·dd |
| Starting state + Remove empty lines + Remove line breaks (Join with nothing) | One line: aa·bbcc·dd |
| Starting state + Remove all spaces and tabs | Three lines: aabb, an empty line, ccdd |
Cleanup options
The options in the “Lines” group:
- Trim each line: removes spaces and tabs at the start and end of every line. Whitespace in the middle of a line is kept.
- Remove empty lines: removes lines with no characters and lines that hold only whitespace.
- Remove line breaks: merges all lines into one. Turning it on reveals “Join with”, where you choose between “Join with a space” and “Join with nothing”.
The options in the “Spaces” group:
- Collapse multiple spaces into one: reduces two or more spaces in a row to one. It counts spaces only, so a run with a tab in the middle is not reduced. For that, turn on “Convert tabs to spaces” too.
- Remove all spaces and tabs: deletes every space and tab. Line breaks stay. With this on, “Collapse multiple spaces into one” has nothing left to do, so it is locked.
- Convert tabs to spaces: replaces each tab with a single space. It does not pad with as many spaces as the tab was wide.
- Convert non-breaking and full-width spaces to ordinary spaces: turns non-breaking spaces (U+00A0) and full-width spaces (U+3000) into ordinary spaces (U+0020). A line indented with full-width spaces loses that indent to “Trim each line” only when this option is on.
Order of operations
Whatever order you switch them on in, the options are always applied in this sequence.
- Convert non-breaking and full-width spaces to ordinary spaces
- Convert tabs to spaces
- Trim each line
- Remove empty lines
- Remove line breaks
- Collapse multiple spaces into one
- Remove all spaces and tabs
Each step works on the output of the one before. Tabs become spaces early, so aa→→bb, separated by two tabs, is reduced to aa·bb at step 6. Line breaks are also removed before spaces are tidied, so any doubled spaces created by joining lines are cleaned up at step 6 as well.
Whitespace you shouldn’t clean up
Where whitespace carries meaning, choose your options with care.
- Code and config files where indentation is syntax: “Trim each line”, on from the start, strips all indentation. Python code and YAML files mean something different without it, so turn this option off for them.
- Tables with tab-separated columns: a table copied from a spreadsheet has tabs between its columns. “Convert tabs to spaces” or “Remove all spaces and tabs” erases the column boundaries, and the text can no longer be pasted back as a table.
- English words hyphenated across a line break: text that ends one line with
inter-and starts the next withnationalcomes out of “Remove line breaks” asinter- national. The hyphen is not removed for you, so fix it by hand.
