Whitespace Remover
Collapse extra spaces, drop blank lines and fix tabs without breaking Persian ZWNJ
About Whitespace Remover
Most "remove extra spaces" tools treat the Persian zero-width non-joiner (U+200C) as whitespace and strip it, which silently turns «میشود» into «میشود» and «کتابها» into «کتابها». This cleaner excludes U+200C and U+200D from every whitespace rule it applies, and only removes them if you tick a separate, clearly flagged option. Everything runs in your browser; the text is never uploaded.
How to use Whitespace Remover
- 1
Paste your text into the input box. The cleaned result is rebuilt as you type, with no button to press.
- 2
Pick the cleanup options: collapse repeated spaces, trim each line, trim the whole text, convert tabs to spaces at width 1, 2, 4 or 8, and normalize NBSP and Unicode spaces.
- 3
Optionally turn on removing blank lines, joining everything into one line, or stripping invisible characters such as ZWSP, BOM and direction marks.
- 4
Tick "Reveal invisible characters" to see spaces, tabs, line breaks, NBSP, ZWNJ and invisibles marked with colored symbols on the output.
- 5
Check the stats row (characters before and after, characters removed, line counts and how many ZWNJ survived), then copy the output.
Frequently asked questions
Does this tool delete the Persian ZWNJ?
Not by default. U+200C and U+200D are deliberately excluded from every whitespace class the cleaner uses, so they pass through untouched. They are only removed if you tick the separate "Remove ZWNJ and ZWJ (risky)" box, and a yellow warning appears the moment you do.
How is "remove invisible characters" different from the ZWNJ option?
The invisible-characters option removes U+200B, U+2060, U+FEFF, U+00AD and the direction marks U+200E, U+200F and U+061C, and never touches U+200C or U+200D. The two options are independent, so it is safe to enable the invisible-character cleanup on Persian text.
Why does "remove blank lines" keep a line that contains only a ZWNJ?
That is intentional. A line counts as blank only when it contains nothing but spaces, tabs or Unicode spaces; a ZWNJ is treated as real content, so the line survives. To drop such a line you would first have to enable the risky ZWNJ removal option.
What are the limits?
Processing is capped at 500,000 characters; longer input is truncated and a warning is shown. The invisible-character preview renders at most 20,000 characters. Line endings are always normalized to LF, so if a file must keep Windows CRLF endings, restore them in your editor after copying.