Clean copied text without rewriting its line breaks
Admin ·
A copied note may have extra spaces from a browser, tabs between fields and line breaks from more than one editor. Select a mode according to which separators the next reader expects.
Compare the five modes on the example
Load example. Trim and collapse removes 13 UTF-16 units and leaves four physical lines. The first line becomes Café patio. The tab between the two Arabic words and the no-break space between C and D remain.
Switch to Full clean to remove the blank second line. The preview now has three output lines. Choose Collapse all whitespace to put the same words on a single line, with an ordinary space between C and D.
| Mode | Change |
|---|---|
| Collapse extra spaces | Two or more consecutive ASCII spaces or tabs become one space. |
| Trim line edges | Leading and trailing ASCII spaces and tabs are removed per line. |
| Trim and collapse | Line edges are trimmed, then interior runs are collapsed. |
| Collapse all whitespace | Runs of Unicode whitespace become one space. Outer spaces are removed. |
| Full clean | Trim and collapse, then remove empty physical lines. |
Replace tabs and keep one blank line
Select Custom cleanup before loading the example. Leave Trim line edges enabled, turn off Collapse inner spaces and set Replace tabs with spaces to a width of 3. Select Keep one per run for blank lines.
The result has three ordinary spaces between Café and patio and three between باب and 42. The summary reports seven spaces removed at line edges, two tabs replaced and one blank line removed. C and D still have a no-break space between them.
With Keep final newline enabled, the downloaded file ends in CRLF. Clear that setting and download again to end with D. The separators between the other surviving lines stay in their original order.
Unicode 18.0 Core Specification, section 5.8 Newline Guidelines
Verify the line separators in the downloaded text
Use Open local text file for a note containing CRLF, LF and CR. Select Trim line edges and download the result. A hex viewer should show the same separator sequence as the decoded source, even if the preview displays each as a normal line break.
Full clean keeps the surviving lines in order. It uses the earlier line’s separator between each pair and retains the original final separator when one was present.
Unicode 18.0 Core Specification, section 5.8 Newline Guidelines
Keep a separator that carries meaning
When an internal tab separates fields, use Trim line edges to preserve it and other interior spacing. Avoid collapsing a tab mixed with adjacent spaces if the next step expects an exact delimiter.
Compare the no-break space between C and D in Non-ASCII Character Finder. The line modes leave U+00A0 alone. The single-line mode follows the Unicode White_Space property, which includes U+00A0 and excludes U+200B.
Common questions
Why do I see a blank output after trimming?
A source containing only spaces and tabs can become empty. The result remains available to download.
Which source file encodings can I open?
Use UTF-8 or UTF-16 or UTF-32 with a byte-order mark. The output file is UTF-8.
Do collapse and tab replacement run independently?
The tool replaces selected tabs first, trims the selected line edges, then collapses interior ASCII space runs. Leave collapse off to retain the chosen tab width. The space count describes trimming and collapse before whole blank lines are removed.