Whitespace / zero-width cleaner
Whitespace / zero-width cleaner. Runs entirely on your device, nothing is uploaded.
Runs on your device. The file is never uploaded.
Whitespace / zero-width cleaner strips six code points: the three zero-width marks, the word joiner, the BOM and the soft hyphen. It also trims spaces and tabs off each line end and squeezes three or more newlines down to two. All three switches start on. Line endings become LF first and always, with no switch to stop it.
Questions
What exactly does this remove?
Three things, each with its own switch. removeZeroWidth, on by default, deletes U+200B, U+200C, U+200D, U+FEFF, U+2060 and the soft hyphen U+00AD. trimTrailing, on by default, strips spaces and tabs at the end of every line. collapseBlankLines, on by default, turns any run of three or more newlines into two, which leaves a single blank line. Line endings are always converted as well: CRLF and a lone CR both become LF, and there is no switch for that one.
Does it strip indentation or double spaces inside a line?
No. Leading whitespace is never touched, so indented code and hanging indents keep their shape. Spaces between words are left alone too. Only spaces and tabs at the end of a line are trimmed, and only when trimTrailing is on. If you want every run of two or more spaces squeezed down to one, that is a job for Find and replace (regex) with a pattern of two spaces or more.
Why did my line endings change when I only wanted trailing spaces gone?
Because the newline pass runs first and unconditionally. The tool starts by rewriting every CRLF and every lone CR as a single LF, then applies whichever of the three switches you left on. A Windows file therefore comes back with Unix line endings even if you turned all three options off. Run the result through a line-ending converter afterwards if your target needs CRLF back.
Which invisible characters does it leave behind?
The directional ones, and a few others. The removal list is fixed at U+200B through U+200D, U+FEFF, U+2060 and U+00AD. The left-to-right and right-to-left marks (U+200E and U+200F), the embedding and override controls (U+202A through U+202E), the isolate controls (U+2066 through U+2069) and the Mongolian vowel separator U+180E all survive. The Invisible-character and homoglyph detector finds those and names them, but it only reports them.
Can I clean a whole folder of files at once?
Yes. This tool is per-file, so drop as many text files as you like and each one is cleaned separately and comes back as its own result. The same options apply to every file in the batch. Twenty files in means twenty results out, and one file failing does not take the rest of the batch with it.
Is my text uploaded anywhere?
No. The whole thing is a handful of regular expressions running in a Web Worker inside this browser tab. There is no upload step, no account and no server call, so the text never leaves your device. Turn your network off and the tool still works, because the site is cached in your browser after the first visit.