Whitespace Cleaner
Trim trailing spaces, collapse blank lines and repeated spaces, remove zero-width and non-breaking spaces, convert tabs and line endings.
0 characters · 1 line
0 characters · 1 line
Changes
How to use
- Paste text copied from a web page, PDF or document into “Your text”, or click “Example” to try it out.
- Choose the rules to apply, such as trimming trailing spaces, collapsing repeated spaces, removing zero-width characters and converting non-breaking spaces. Your choices are remembered.
- If needed, choose how to handle empty lines, convert between tabs and spaces, or unify line endings.
- For text hard-wrapped by a PDF, set “Remove line breaks” to “Auto”: lines are joined with a space, but without one next to Chinese or Japanese characters.
- “Changes” lists how much each rule changed. Click “Copy” or “Download” to grab the result.
FAQ
Is my text uploaded?
No. Everything is cleaned in your browser, and your text never leaves your device.
What are zero-width characters, and why remove them?
They are invisible characters that take up no space: zero-width space (U+200B), word joiner (U+2060), byte order mark (U+FEFF) and soft hyphen (U+00AD). They often come along when copying from web pages or chat apps and break searches, comparisons and code. The zero-width joiner (U+200D) that emoji such as 👨👩👧 need is never removed.
What is the difference between non-breaking and full-width spaces?
A non-breaking space (NBSP, U+00A0) looks like a normal space but confuses searches, spreadsheets and programs, so it is usually safe to convert. The full-width space (U+3000) is used to indent paragraphs in Chinese, so it is only converted when you turn that option on.
How does “Auto” decide when joining lines?
Where two lines meet, they are joined directly if the character on either side is Chinese, Japanese kana, Bopomofo or full-width punctuation, and with one space otherwise. With “Keep paragraphs”, blank lines stay as paragraph breaks and only lines within a paragraph are joined.
Does “Collapse repeated spaces” change indentation?
No. Only runs of spaces and tabs after the first visible character are collapsed; indentation at the start of a line is kept. Turn on “Trim leading spaces” to remove it.
How are tabs converted to spaces?
Each tab is expanded to the next tab stop (every 2, 4 or 8 columns, set by “Tab width”), so columns line up as in a code editor. “Leading spaces to tabs” only rewrites the indentation at the start of each line.
What is the difference between LF and CRLF?
Windows uses CRLF (\r\n) to end lines, while macOS and Linux use LF (\n). Some programs and version control systems are picky about this, so you can convert everything to one style here, or keep the line endings as they are.
Related tools
Remove Duplicate Lines
Remove duplicate lines from text, optionally ignoring case and whitespace, or list only the lines that repeat.Find & Replace
Find and replace text in bulk with case and whole-word options or regular expressions with $1 groups, with matches highlighted.Pangu Spacing
Automatically add spaces between Chinese and English text or digits, with every change highlighted and Markdown and code kept intact.