Skip to content
Test versionSearch

Text and writing

Clean up whitespace

Choose one operation at a time. Collapse replaces horizontal whitespace with one ordinary space while preserving line breaks. Remove-all also removes line breaks. Trim changes only line edges. Blank-line removal normalises line endings. Zero-width removal deletes U+200B, U+200C, U+200D and U+FEFF; it can break joined emoji and meaningful script shaping. Review the result before reuse.

How it worksFAQRelated tools

Content reviewed:

Also available for Germany, in German 

Paste text, choose options and calculate. Up to 20,000 UTF-16 code units (an emoji can use more than one). Empty input is allowed except for naming conversion.

Processing stays in this browser tab. Input is not sent, saved in browser storage or added to the URL. The original TXT download contains the result. The additional JSON export contains the input, selected options and exact result. Copy may require permission; selecting text is available as a fallback. Changing an input clears the previous result. Optional own UTF-8 file up to 32 KiB and 20000 UTF-16 units; raw file and form line endings are recorded separately. CSV protects formula-like lines with an apostrophe; printable HTML refuses unsupported control characters. Optional live calculation is off by default.

How it works

Choose one operation at a time. Collapse replaces horizontal whitespace with one ordinary space while preserving line breaks. Remove-all also removes line breaks. Trim changes only line edges. Blank-line removal normalises line endings. Zero-width removal deletes U+200B, U+200C, U+200D and U+FEFF; it can break joined emoji and meaningful script shaping. Review the result before reuse. Additional own JSON/numbered-line CSV/printable HTML exports record the unchanged calculation result. Processing stays in this browser tab. Input is not sent, saved in browser storage or added to the URL. The original TXT download contains the result. The additional JSON export contains the input, selected options and exact result. Copy may require permission; selecting text is available as a fallback. Changing an input clears the previous result. Optional own UTF-8 file up to 32 KiB and 20000 UTF-16 units; raw file and form line endings are recorded separately. CSV protects formula-like lines with an apostrophe; printable HTML refuses unsupported control characters. Optional live calculation is off by default.

Worked example

Example input: Hello world example

Worked example

With these example values the calculator gives the result below. You can change any value in the form above.

Inputs

Input text
Own sample own text
Operation
Collapse horizontal whitespace

Result

Result
Unicode code points: 21

Frequently asked questions

How do I remove extra spaces from text?

Choose the collapse operation in the whitespace cleaner. It replaces runs of horizontal whitespace with one ordinary space while preserving line breaks.

How do I remove all line breaks from text?

Choose remove-all. Unlike collapse, the remove-all operation also removes line breaks, so the text ends up on one line.

How do I trim spaces at the start and end of lines?

Use the trim operation. It changes only the edges of each line and leaves the whitespace inside a line as it is.

How do I delete blank lines?

Choose blank-line removal. The whitespace cleaner deletes empty lines and normalises the line endings at the same time.

How do I remove zero-width characters?

Zero-width removal deletes U+200B, U+200C, U+200D and U+FEFF. This can break joined emoji and meaningful script shaping, so review the result before reuse.

How much text can the whitespace cleaner handle?

Up to 20,000 UTF-16 code units, where an emoji can use more than one. An optional UTF-8 file of up to 32 KiB can be loaded instead of pasting.

Can I apply several whitespace operations at once?

No. The whitespace cleaner applies one operation at a time. Run it again on the result to combine, for example, trimming and blank-line removal.