Whitespace Cleaner
Paste text to convert every tab to one space, trim each line and delete blank lines in one pass - output updates live, Windows CRLF comes out as LF.
Still loading. If the tool doesn’t appear, reload this page.
About this tool
Whitespace Cleaner
Trim each line, convert tabs to spaces and drop blank lines.
Whitespace Cleaner scans pasted text for 31 invisible and look-alike characters — zero-width space, zero-width joiner, word joiner, soft hyphen, byte-order mark, direction marks, non-breaking and Unicode spaces, stray control codes and carriage returns — then removes or normalises the ones you choose and shows a report naming each character, its Unicode code point, how many were found and how many remain. A Reveal invisibles panel prints your original text with a labelled marker in place of every hidden character, including the ordinary spaces sitting at the end of a line, so you can see exactly what is in the string rather than guessing. Ten switches cover tabs, line endings, leading and trailing whitespace and blank lines. Everything runs in your browser tab, so the text is never uploaded.
How to use Whitespace Cleaner
Paste your text into “Your text”, or press Load sample for a block seeded with a BOM, zero-width spaces, a narrow no-break space, a soft hyphen, a word joiner and CRLF endings.
Read the “What was in your text” table — each row gives the Unicode name, the code point such as U+200B, how many were found, how many are still in the output, and the action applied. Adjust the switches under Clean-up options, grouped as Invisible characters, Tabs and line endings, and Lines.
Open Reveal invisibles to see the markers in place, then press Copy or Download to save the result as whitespace-cleaned.txt.
Why use Whitespace Cleaner
Names what it found, not just what it fixed
The report lists every detected character by its Unicode name and code point — U+200B zero width space, U+FEFF BOM, U+00A0 no-break space — with a found count, a still-there count and the action being applied.
A preview that makes invisible text visible
Reveal invisibles reprints your text with a labelled marker for each hidden character, and flags plain spaces at the end of a line with an SP marker, so the problem is something you can point at.
Removes and normalises separately
Zero-width and formatting characters are deleted, while Unicode spaces such as NBSP, en, em, thin and ideographic spaces are converted to an ordinary space — so word boundaries survive instead of two words being welded together.
Line-level clean-up in the same pass
Trailing whitespace, indentation, CRLF line endings, repeated spaces and blank lines each have their own switch, so a single paste can produce exactly the shape you need.
Common use cases
- Two strings look identical on screen but a lookup, a de-duplication or a database join keeps treating them as different, and you need to find the zero-width space or non-breaking space hiding inside one of them.
- A CSV saved as UTF-8 with signature imports with its first column header mangled, because a byte-order mark is sitting invisibly in front of it.
- Text pasted from a rich editor into code or a CMS wraps in the wrong places or fails validation, and you need the Unicode spaces and formatting marks normalised before you commit it.
Frequently asked questions
How do I find a zero-width character in my text?
Paste the text and read the report: every zero-width and invisible character it contains is listed by name and code point with a count. Then open Reveal invisibles, which reprints the text with a labelled marker — ZWSP, ZWJ, WJ, BOM, SHY — exactly where each one sits.
Link to answerWhy does the tool replace some characters with a space but delete others?
Because they do different jobs. A no-break space or an em space occupies the position of a real space, so deleting it would join two words together; it is converted to an ordinary space instead. A zero-width space or a byte-order mark has no width and no meaning in plain text, so it is removed entirely.
Link to answerDoes it remove blank lines or change my paragraph breaks?
Not unless you ask. “Remove blank lines” and “Trim the whole block” are both off by default, so paragraph spacing survives. What is on by default is deleting zero-width and control characters, normalising Unicode spaces and CRLF endings, converting tabs and stripping trailing whitespace.
Link to answerIs the whole text scanned, or only the preview?
The scan, the report and the clean-up all cover the entire text. Only the Reveal invisibles preview is capped, at 6,000 characters, because rendering a marker element per character gets slow on very long documents — the panel says so when it truncates.
Link to answerIs my text uploaded anywhere?
No. Detection and clean-up are plain JavaScript running in the page. Nothing is sent to a server, nothing is stored, and the tool keeps working offline once the page has loaded — which matters, because the text people bring here is often a database export or a private document.
Link to answer